kalle Tue Mar 3 11:50:33 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/standard/tests/strings bug47546.phpt
Modified files: /php-src NEWS /php-src/ext/standard string.c Log: MFH: Fixed bug #47546 (Default value for limit parameter in explode is 0, not -1) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1432&r2=1.2027.2.547.2.1433&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1432 php-src/NEWS:1.2027.2.547.2.1433 --- php-src/NEWS:1.2027.2.547.2.1432 Sun Mar 1 17:36:09 2009 +++ php-src/NEWS Tue Mar 3 11:50:32 2009 @@ -3,6 +3,8 @@ ?? ??? 2009, PHP 5.2.10 - Fixed memory corruptions while reading properties of zip files. (Ilia) +- Fixed bug #47546 (Default value for limit parameter in explode is 0, + not -1). (Kalle) - Fixed bug #47435 (FILTER_FLAG_NO_PRIV_RANGE does not work with ipv6 addresses in the filter extension). (Ilia) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.81&r2=1.445.2.14.2.82&diff_format=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.445.2.14.2.81 php-src/ext/standard/string.c:1.445.2.14.2.82 --- php-src/ext/standard/string.c:1.445.2.14.2.81 Sat Feb 14 07:00:24 2009 +++ php-src/ext/standard/string.c Tue Mar 3 11:50:32 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.445.2.14.2.81 2009/02/14 07:00:24 moriyoshi Exp $ */ +/* $Id: string.c,v 1.445.2.14.2.82 2009/03/03 11:50:32 kalle Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1042,7 +1042,7 @@ if (limit == 0 || limit == 1) { add_index_stringl(return_value, 0, Z_STRVAL_PP(str), Z_STRLEN_PP(str), 1); - } else if (limit < 0 && argc == 3) { + } else if (limit < -1 && argc == 3) { php_explode_negative_limit(*delim, *str, return_value, limit); } else { php_explode(*delim, *str, return_value, limit); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug47546.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/bug47546.phpt +++ php-src/ext/standard/tests/strings/bug47546.phpt --TEST-- Bug #47546 (Default value for limit parameter in explode is 0, not -1) --FILE-- <?php $str = 'one|two|three|four'; print_r(explode('|', $str)); print_r(explode('|', $str, -1)); ?> --EXPECT-- Array ( [0] => one [1] => two [2] => three [3] => four ) Array ( [0] => one [1] => two [2] => three [3] => four ) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php