Bug #75089 [Opn->Ver]: preg_grep() is not reporting PREG_BAD_UTF8_ERROR after first input string

From: Date: Fri, 18 Aug 2017 08:37:34 +0000
Subject: Bug #75089 [Opn->Ver]: 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-210727@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:         requinix@php.net
 Reported by:        david at grudl dot com
-Summary:            preg_grep() is not reporting PREG_BAD_UTF8_ERROR
+Summary:            preg_grep() is not reporting PREG_BAD_UTF8_ERROR
                     after first input string
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            PCRE related
 PHP Version:        7.2.0beta3
-Assigned To:        
+Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.bugs (#210727) next »