iliaa           Mon Jul 30 14:22:06 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/standard       string.c 
    /php-src    NEWS 
  Log:
  
  Fixed bug #42142 (substr_replace() returns FALSE when length > string
  length).
  
  [doc] Adjust length validation check inside substr_replace() to be similar
  to that inside substr() so that excessive length is truncated to string
  length.
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.65&r2=1.445.2.14.2.66&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.65 
php-src/ext/standard/string.c:1.445.2.14.2.66
--- php-src/ext/standard/string.c:1.445.2.14.2.65       Mon Jul 23 13:27:58 2007
+++ php-src/ext/standard/string.c       Mon Jul 30 14:22:06 2007
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.65 2007/07/23 13:27:58 jani Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.66 2007/07/30 14:22:06 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2226,7 +2226,7 @@
                        if (f > Z_STRLEN_PP(str) || (f < 0 && -f > 
Z_STRLEN_PP(str))) {
                                RETURN_FALSE;
                        } else if (l > Z_STRLEN_PP(str) || (l < 0 && -l > 
Z_STRLEN_PP(str))) {
-                               RETURN_FALSE;
+                               l = Z_STRLEN_PP(str);
                        }
 
                        if ((f + l) > Z_STRLEN_PP(str)) {
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.864&r2=1.2027.2.547.2.865&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.864 php-src/NEWS:1.2027.2.547.2.865
--- php-src/NEWS:1.2027.2.547.2.864     Sun Jul 29 14:43:30 2007
+++ php-src/NEWS        Mon Jul 30 14:22:06 2007
@@ -70,6 +70,8 @@
 - Fixed PECL bug #11216 (crash in ZipArchive::addEmptyDir when a directory 
   already exists). (Pierre)
 
+- Fixed bug #42142 (substr_replace() returns FALSE when length > string
+  length). (Ilia) 
 - Fixed bug #42135 (Second call of session_start() causes creation of SID).
   (Ilia)
 - Fixed Bug #42112 (deleting a node produces memory corruption). (Rob)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to