ID: 42737
Updated by: [EMAIL PROTECTED]
Reported By: rm at drgs dot no
-Status: Open
+Status: Assigned
Bug Type: PCRE related
Operating System: Mac OS X 10.3.9
PHP Version: 5.2.4
-Assigned To:
+Assigned To: nlopess
Previous Comments:
------------------------------------------------------------------------
[2007-09-22 20:17:43] rm at drgs dot no
this seems to be the case with all strings which end with "\r\n"
btw, theres an extra obsolete parantesis at the end of the second
line in reproduce code, sorry
------------------------------------------------------------------------
[2007-09-22 20:11:09] rm at drgs dot no
Description:
------------
I'm splitting a string into characters with this:
preg_split('//u', $string, - 1, PREG_SPLIT_NO_EMPTY);
I get a notice on an uknown error which happens when I use the
unicode suffix u in the pattern and when the input string is
"\r\n":
$string = chr(13).chr(10);
but not when i drop the unicode option, ie. this works fine:
preg_split('//', $string, - 1, PREG_SPLIT_NO_EMPTY);
Reproduce code:
---------------
$string = chr(13).chr(10);
$array = preg_split('//u', $string, - 1, PREG_SPLIT_NO_EMPTY));
print_r(array_map('ord', $array));
Expected result:
----------------
Array
(
[0] => 13
[1] => 10
)
Actual result:
--------------
<br />
<b>Notice</b>: preg_split() [<a href='function.preg-
split'>function.preg-split</a>]: Unknown error in <b>/Users/
myname/Sites/script.php</b> on line <b>73</b><br />
Array
(
[0] => 13
[1] => 10
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42737&edit=1