#43567 [Opn->Bgs]: PCRE: compilation failure when using UTF-8

From: Date: Sun, 13 Jan 2008 15:11:17 +0000
Subject: #43567 [Opn->Bgs]: PCRE: compilation failure when using UTF-8
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121245@lists.php.net to get a copy of this message
ID: 43567 Updated by: nlopess@php.net Reported By: brito_victor at yahoo dot fr -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Windows XP SP2 PHP Version: 5.2.5 New Comment: In PHP 5.2.5 we upgraded PCRE to version 7.3. This version has stricter UTF-8 string validation, and thats why the string is now rejected. For the record this bug has nothing to do with the mbstring extension. Previous Comments: ------------------------------------------------------------------------ [2007-12-13 12:54:50] brito_victor at yahoo dot fr I think it is a bug because, when the script is tested within version 5.2.4, it returns true. ------------------------------------------------------------------------ [2007-12-13 12:48:17] confins_de_l_univers at yahoo dot fr I've got the same error on linux (Debian Etch). But your pattern (and your subject) is not a valid utf-8 string. I've checked that with : mb_check_encoding("\xf8\xa1\xa1\xa1\xa1", 'UTF-8') and it returns false. So, I think it's not a bug. ------------------------------------------------------------------------ [2007-12-11 17:08:55] brito_victor at yahoo dot fr Bug seen on Windows XP SP2. ------------------------------------------------------------------------ [2007-12-11 17:02:04] brito_victor at yahoo dot fr Description: ------------ In a test script, I call preg_match() function, using the flag u, in order to test an UTF-8 regular expression with hexadecimal characters. Of course, the mbstring extension is loaded and active. Reproduce code: --------------- $mb = function_exists('mb_detect_encoding'); $pregutf8 = preg_match("/\xf8\xa1\xa1\xa1\xa1/u", "\xf8\xa1\xa1\xa1\xa1"); Expected result: ---------------- Returns true for both variables. Actual result: -------------- Returns true for $mb. Returns the following warning message for $pregutf8: "Warning: preg_match() [function.preg-match]: Compilation failed: invalid UTF-8 string at offset 0" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43567&edit=1

« previous php.bugs (#121245) next »