#42737 [Asn->Csd]: Notice: preg_split(): Unknown error
| From: | nlopess@php.net | Date: | Sun, 07 Oct 2007 13:57:13 +0000 |
| Subject: | #42737 [Asn->Csd]: Notice: preg_split(): Unknown error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118277@lists.php.net to get a copy of this message | ||
ID: 42737
Updated by: nlopess@php.net
Reported By: rm at drgs dot no
-Status: Assigned
+Status: Closed
Bug Type: PCRE related
Operating System: Mac OS X 10.3.9
PHP Version: 5.2.4
Assigned To: nlopess
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
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