|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-12-11 17:02 UTC] 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"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 21:00:01 2025 UTC |
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.