Statement on glibc/iconv Vulnerability

preg_last_error_msg

(PHP 8)

preg_last_error_msg最後に実行した PCRE 正規表現に関するエラーメッセージを返す

説明

preg_last_error_msg(): string

最後に実行した PCRE 正規表現に関するエラーメッセージを返します。

パラメータ

この関数にはパラメータはありません。

戻り値

成功した場合はエラーメッセージを返します。 エラーが起きていない場合は、"No error" を返します。

例1 preg_last_error_msg() example

<?php

preg_match
('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar');

if (
preg_last_error() !== PREG_NO_ERROR) {
echo
preg_last_error_msg();
}

?>

上の例の出力は以下となります。

Backtrack limit exhausted

参考

  • preg_last_error() - 直近の PCRE 正規表現処理のエラーコードを返す

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top