php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31965 PREG_SPLIT_NO_EMPTY strips non-empty pieces in some cases
Submitted: 2005-02-14 10:27 UTC Modified: 2005-07-05 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: mikael at SPAMMENOTchl dot chalmers dot se Assigned:
Status: No Feedback Package: PCRE related
PHP Version: 5CVS, 4CVS (2005-05-30) OS: *
Private report: No CVE-ID: None
 [2005-02-14 10:27 UTC] 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
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-27 01:22 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

PCRE was upgraded to version 5.0.
 [2005-07-05 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 21:01:27 2024 UTC