|  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
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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
45 - 16 = ?
Subscribe to this entry?

 [2005-02-14 10:27 UTC] mikael at SPAMMENOTchl dot chalmers dot se
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);

Expected result:
    [0] => ser1
    [1] => ia456
    [2] => l

Actual result:
    [0] => ser1
    [1] => ia456


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-27 01:22 UTC]
Please try using this CVS snapshot:
For Windows:

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-2023 The PHP Group
All rights reserved.
Last updated: Mon Jun 05 21:03:37 2023 UTC