#31965 [Opn->Ver]: PREG_SPLIT_NO_EMPTY strips non-empty pieces in some cases

From: Date: Tue, 15 Feb 2005 13:13:24 +0000
Subject: #31965 [Opn->Ver]: PREG_SPLIT_NO_EMPTY strips non-empty pieces in some cases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-74099@lists.php.net to get a copy of this message
 ID:               31965
 Updated by:       sniper@php.net
 Reported By:      mikael at SPAMMENOTchl dot chalmers dot se
-Status:           Open
+Status:           Verified
 Bug Type:         PCRE related
-Operating System: Linux
+Operating System: *
-PHP Version:      4.3.8
+PHP Version:      4CVS, 5CVS (2005-02-15)


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

[2005-02-14 10:27:15] mikael at SPAMMENOTchl dot chalmers dot se

Description:
------------
In some cases the preg_split strips non-empty pieces when the
PREG_SPLIT_NO_EMPTY flag i set. Specifically when using assertions only
to split on, eg. the string to split on itself is actually empty (but
not the pieces)

Reproduce code:
---------------
$terms = preg_split('/(?<=\d)(?=[a-zåäö])/', 'ser1ia456l', 0,
PREG_SPLIT_NO_EMPTY);
print_r($terms);


Expected result:
----------------
Array
(
    [0] => ser1
    [1] => ia456
    [2] => l
)

Actual result:
--------------
Array
(
    [0] => ser1
    [1] => ia456
)


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


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


Thread (3 messages)

« previous php.bugs (#74099) next »