|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-04-02 22:36 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 19:00:02 2025 UTC |
Description: ------------ preg_split with PREG_SPLIT_NO_EMPTY is buggy when splitting on greedy patterns. See reproduce code. preg_split in PHP 4.4.8 similarly buggy. Reproduce code: --------------- <?php $s = " 1 2 3 "; print_r (preg_split ("/ +/", $s)); print_r (preg_split ("/ +/", $s, PREG_SPLIT_NO_EMPTY)); ?> Expected result: ---------------- Array ( [0] => [1] => 1 [2] => 2 [3] => 3 [4] => ) Array ( [0] => 1 [1] => 2 [2] => 3 ) Actual result: -------------- Array ( [0] => [1] => 1 [2] => 2 [3] => 3 [4] => ) Array ( [0] => 1 2 3 )