kalle Tue Mar 3 11:46:20 2009 UTC
Added files:
/php-src/ext/standard/tests/strings bug47546.phpt
Modified files:
/php-src/ext/standard string.c
Log:
Fixed bug #47546 (Default value for limit parameter in explode is 0, not -1)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.692&r2=1.693&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.692 php-src/ext/standard/string.c:1.693
--- php-src/ext/standard/string.c:1.692 Sat Feb 14 06:59:36 2009
+++ php-src/ext/standard/string.c Tue Mar 3 11:46:19 2009
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.692 2009/02/14 06:59:36 moriyoshi Exp $ */
+/* $Id: string.c,v 1.693 2009/03/03 11:46:19 kalle Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -1311,7 +1311,7 @@
} else {
add_index_stringl(return_value, 0, (char *)str,
str_len, 1);
}
- } else if (limit < 0 && argc == 3) {
+ } else if (limit < -1 && argc == 3) {
if ( str_type == IS_UNICODE ) {
php_u_explode_negative_limit((UChar *)delim, delim_len,
(UChar *)str, str_len, return_value, limit);
} else {
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