Bug #75089 [Ver->Csd]: preg_grep() is not reporting PREG_BAD_UTF8_ERROR after first input string
| From: | dmitry@php.net | Date: | Fri, 18 Aug 2017 11:58:21 +0000 |
| Subject: | Bug #75089 [Ver->Csd]: preg_grep() is not reporting PREG_BAD_UTF8_ERROR after first input string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210733@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75089&edit=1
ID: 75089
Updated by: dmitry@php.net
Reported by: david at grudl dot com
Summary: preg_grep() is not reporting PREG_BAD_UTF8_ERROR
after first input string
-Status: Verified
+Status: Closed
Type: Bug
Package: PCRE related
PHP Version: 7.2.0beta3
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ef90e37bd15db5ecea57e03ad72a53acd844b706
Log: Fixed bug #75089 (preg_grep() is not reporting PREG_BAD_UTF8_ERROR after first input string)
Previous Comments:
------------------------------------------------------------------------
[2017-08-18 08:37:33] requinix@php.net
Note that it does work when the string is the first in the list.
https://github.com/php/php-src/commit/8dc6b41011c59d7df2b9227e4dbd67f242372ba8
https://github.com/php/php-src/blob/php-7.2.0beta3/ext/pcre/php_pcre.c#L2595
+ /* the string was already proved to be valid UTF-8 */
+ no_utf_check = PCRE_NO_UTF8_CHECK;
That should not be in there.
------------------------------------------------------------------------
[2017-08-18 07:56:24] david at grudl dot com
Description:
------------
preg_grep() is not reporting PREG_BAD_UTF8_ERROR
test script: https://3v4l.org/3aY3r
Test script:
---------------
<?php
preg_grep('#\d#u', ['a', "1\xFF", 'c']); // array contains
invalid utf-8 string
var_dump(preg_last_error()); // returns PREG_BAD_UTF8_ERROR in PHP < 7.2 and 0 in PREG_NO_ERROR
in PHP 7.2
Expected result:
----------------
PREG_BAD_UTF8_ERROR
Actual result:
--------------
PREG_NO_ERROR
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75089&edit=1