mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

Provides the last PCRE error as a human-readable message, similar to functionality existing in other extensions, such as json_last_error_msg(). Closes GH-5185.
11 lines
351 B
PHP
11 lines
351 B
PHP
--TEST--
|
|
Test preg_match() function : error conditions - Malformed UTF-8 offset
|
|
--FILE--
|
|
<?php
|
|
preg_match('/a/u', "\xE3\x82\xA2", $m, 0, 1);
|
|
var_dump(preg_last_error() === PREG_BAD_UTF8_OFFSET_ERROR);
|
|
var_dump(preg_last_error_msg() === 'The offset did not correspond to the beginning of a valid UTF-8 code point');
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
bool(true)
|