#42737 [Opn->Asn]: Notice: preg_split(): Unknown error
| From: | tony2001@php.net | Date: | Tue, 02 Oct 2007 10:27:35 +0000 |
| Subject: | #42737 [Opn->Asn]: Notice: preg_split(): Unknown error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118068@lists.php.net to get a copy of this message | ||
ID: 42737
Updated by: tony2001@php.net
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