kalle           Tue Mar  3 11:47:31 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/standard/tests/strings bug47546.phpt 

  Modified files:              
    /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/ext/standard/string.c?r1=1.445.2.14.2.69.2.42&r2=1.445.2.14.2.69.2.43&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.69.2.42 
php-src/ext/standard/string.c:1.445.2.14.2.69.2.43
--- php-src/ext/standard/string.c:1.445.2.14.2.69.2.42  Sat Feb 14 06:59:55 2009
+++ php-src/ext/standard/string.c       Tue Mar  3 11:47:31 2009
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.69.2.42 2009/02/14 06:59:55 moriyoshi Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.69.2.43 2009/03/03 11:47:31 kalle Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -1027,7 +1027,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

Reply via email to