ID:               48464
 Updated by:       j...@php.net
 Reported By:      daniel at poradnik-webmastera dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         PCRE related
 Operating System: windows xp
 PHP Version:      5.2.9
-Assigned To:      
+Assigned To:      nlopess
 New Comment:

Nuno, how come the script says "match" with HEAD?


Previous Comments:
------------------------------------------------------------------------

[2009-06-03 20:49:50] scott...@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Check preg_last_error() it will return PREG_BAD_UTF8_ERROR

\xab isn't valid UTF-8, however \xc2\xab is. It should be 2 bytes.

------------------------------------------------------------------------

[2009-06-03 20:49:19] j...@php.net

Works in HEAD.

------------------------------------------------------------------------

[2009-06-03 20:48:44] nlop...@php.net

$str is not a valid UTF-8 string, and thus the pcre engine rejects it.
no bug here.

------------------------------------------------------------------------

[2009-06-03 17:50:59] daniel at poradnik-webmastera dot com

Description:
------------
preg_match() doesn't match string when utf-8 mode is enabled and 0xAB
char ("«") is present in input. Everything works correctly when
utf-8 mode is disabled.

Reproduce code:
---------------
<?php

$str = "test \xab test";

if (preg_match('/test/u', $str))
        echo 'Match';
else
        echo 'No match';

?>

Expected result:
----------------
'Match' printed

Actual result:
--------------
'No match' printed


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48464&edit=1

Reply via email to