|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mikael at SPAMMENOTchl dot chalmers dot se
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 06:01:31 2024 UTC