]> granicus.if.org Git - php/commitdiff
Revert bug #54454 fix from PHP_5_3 branch to avoid BC break in minor release
authorPierrick Charron <pierrick@php.net>
Thu, 21 Apr 2011 01:51:24 +0000 (01:51 +0000)
committerPierrick Charron <pierrick@php.net>
Thu, 21 Apr 2011 01:51:24 +0000 (01:51 +0000)
NEWS
ext/standard/string.c
ext/standard/tests/strings/bug54454.phpt [deleted file]
ext/standard/tests/strings/substr_compare.phpt

diff --git a/NEWS b/NEWS
index 4c2b338248189eb632e2ffe0be8ab7eb1d8c1b7d..ed3e8578b9bc016f1f88ed2fdefef2150bf0d19f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,8 +18,6 @@ PHP                                                                        NEWS
   . Implemented FR #54459 (Range function accuracy). (Adam)
   . Added PHP_MANDIR constant telling where the manpages were installed into,
     and an --man-dir argument to php-config. (Hannes)
-  . Fixed bug #54454 (substr_compare incorrectly reports equality in some 
-    cases). (Pierrick)
   . Fixed bug #54238 (use-after-free in substr_replace()). (Stas)
     (CVE-2011-1148)
   . Fixed bug #54180 (parse_url() incorrectly parses path when ? in fragment).
index a8b87e94f311a17f3572b218c60678e3e8d02589..ec3a5b28c6ea07d1387b09c19ca488b929bf0aef 100644 (file)
@@ -5278,6 +5278,10 @@ PHP_FUNCTION(substr_compare)
                RETURN_FALSE;
        }
 
+       if (len > s1_len - offset) {
+               len = s1_len - offset;
+       }
+
        cmp_len = (uint) (len ? len : MAX(s2_len, (s1_len - offset)));
 
        if (!cs) {
diff --git a/ext/standard/tests/strings/bug54454.phpt b/ext/standard/tests/strings/bug54454.phpt
deleted file mode 100644 (file)
index 88835c9..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Bug #54454 (substr_compare incorrectly reports equality in some cases)
---FILE--
-<?php
-var_dump(substr_compare('/', '/asd', 0, 4));
-?>
---EXPECT--
-int(-3)
index c647506b53736a7ee244e1e98127aa9f9fccb1ab..206ccd5edea0183f99f317d599e40a7f2c7ac943 100644 (file)
@@ -27,7 +27,7 @@ int(-1)
 
 Warning: substr_compare(): The start position cannot exceed initial string length in %s on line %d
 bool(false)
-int(-1)
+int(0)
 
 Warning: substr_compare() expects parameter 5 to be boolean, object given in %s on line %d
 bool(false)