#43567 [Com]: PCRE: compilation failure when using UTF-8

From: Date: Thu, 13 Dec 2007 12:48:17 +0000
Subject: #43567 [Com]: PCRE: compilation failure when using UTF-8
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120631@lists.php.net to get a copy of this message
ID: 43567 Comment by: confins_de_l_univers at yahoo dot fr Reported By: brito_victor at yahoo dot fr Status: Open Bug Type: PCRE related Operating System: Windows XP SP2 PHP Version: 5.2.5 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#120631) next »