xref: /PHP-8.3/ext/pcre/tests/errors06.phpt (revision aa79a22d)
1--TEST--
2Test preg_match() function : error conditions - Malformed UTF-8 offset
3--FILE--
4<?php
5preg_match('/a/u', "\xE3\x82\xA2", $m, 0, 1);
6var_dump(preg_last_error() === PREG_BAD_UTF8_OFFSET_ERROR);
7var_dump(preg_last_error_msg() === 'The offset did not correspond to the beginning of a valid UTF-8 code point');
8?>
9--EXPECT--
10bool(true)
11bool(true)
12