cvs: php-src(PHP_5_2) /ext/standard string.c /ext/standard/tests/strings bug40754.phpt

From: Date: Fri, 09 Mar 2007 10:04:59 +0000
Subject: cvs: php-src(PHP_5_2) /ext/standard string.c /ext/standard/tests/strings bug40754.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-43479@lists.php.net to get a copy of this message
tony2001 Fri Mar 9 10:04:59 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard string.c /php-src/ext/standard/tests/strings bug40754.phpt Log: fix substr() it's perfectly legal to do substr("str", 0, 1000000); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.50&r2=1.445.2.14.2.51&diff_format=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.445.2.14.2.50 php-src/ext/standard/string.c:1.445.2.14.2.51 --- php-src/ext/standard/string.c:1.445.2.14.2.50 Fri Mar 9 01:58:34 2007 +++ php-src/ext/standard/string.c Fri Mar 9 10:04:59 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.445.2.14.2.50 2007/03/09 01:58:34 iliaa Exp $ */ +/* $Id: string.c,v 1.445.2.14.2.51 2007/03/09 10:04:59 tony2001 Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2063,7 +2063,7 @@ if (argc > 2) { convert_to_long_ex(len); l = Z_LVAL_PP(len); - if (l > Z_STRLEN_PP(str) || (l < 0 && -l > Z_STRLEN_PP(str))) { + if ((l < 0 && -l > Z_STRLEN_PP(str))) { RETURN_FALSE; } } else { http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/bug40754.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/strings/bug40754.phpt diff -u php-src/ext/standard/tests/strings/bug40754.phpt:1.1.2.1 php-src/ext/standard/tests/strings/bug40754.phpt:1.1.2.2 --- php-src/ext/standard/tests/strings/bug40754.phpt:1.1.2.1 Fri Mar 9 01:58:34 2007 +++ php-src/ext/standard/tests/strings/bug40754.phpt Fri Mar 9 10:04:59 2007 @@ -27,36 +27,36 @@ ?> --EXPECTF-- -bool(false) +string(4) "bcde" bool(false) bool(false) bool(false) -Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s/bug40754.php on line %d +Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s on line %d bool(false) -Warning: substr_compare(): The start position cannot exceed initial string length in %s/bug40754.php on line %d +Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d bool(false) -Warning: stripos(): Offset not contained in string. in %s/bug40754.php on line %d +Warning: stripos(): Offset not contained in string. in %s on line %d bool(false) -Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s/bug40754.php on line %d +Warning: substr_count(): Offset value 2147483647 exceeds string length. in %s on line %d bool(false) -Warning: substr_count(): Length value 2147483647 exceeds string length. in %s/bug40754.php on line %d +Warning: substr_count(): Length value 2147483647 exceeds string length. in %s on line %d bool(false) -Warning: strpos(): Offset not contained in string. in %s/bug40754.php on line %d +Warning: strpos(): Offset not contained in string. in %s on line %d bool(false) -Warning: stripos(): Offset not contained in string. in %s/bug40754.php on line %d +Warning: stripos(): Offset not contained in string. in %s on line %d bool(false) -Notice: strrpos(): Offset is greater than the length of haystack string in %s/bug40754.php on line %d +Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d bool(false) -Notice: strripos(): Offset is greater than the length of haystack string in %s/bug40754.php on line %d +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d bool(false) int(2) string(8) "abcdeabc"

« previous php.cvs (#43479) next »