]> granicus.if.org Git - php/commitdiff
Normalise strr(i)pos offset messages with str(i)pos ones.
authorGeorge Peter Banyard <girgias@php.net>
Thu, 22 Aug 2019 09:09:44 +0000 (11:09 +0200)
committerGeorge Peter Banyard <girgias@php.net>
Thu, 22 Aug 2019 10:56:32 +0000 (12:56 +0200)
ext/mbstring/tests/bug43841.phpt
ext/mbstring/tests/bug45923.phpt
ext/standard/string.c
ext/standard/tests/strings/bug40754.phpt
ext/standard/tests/strings/strripos_offset.phpt
ext/standard/tests/strings/strrpos_offset.phpt

index 01ae2a7525b142b4a9fd46e2391339f74db78024..ab52eb51c94acdbc96a70a1d119bd2d17dace01b 100644 (file)
@@ -46,7 +46,7 @@ Warning: mb_strrpos(): Offset is greater than the length of haystack string in %
 bool(false)
 strrpos:
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 
 -- Offset is -24 --
@@ -61,7 +61,7 @@ Warning: mb_strrpos(): Offset is greater than the length of haystack string in %
 bool(false)
 strrpos:
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 
 -- Offset is -13 --
index eace49678c73e831936337493d811991a8ff82af..6fc8e1db0989c5b500487293a846b3bd792db7df 100644 (file)
@@ -149,7 +149,7 @@ bool(false)
 bool(false)
 > Offset: 12
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 > Offset: -1
 int(8)
@@ -159,7 +159,7 @@ int(8)
 int(4)
 > Offset: -20
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 
 ------- mb_strrpos -----------
@@ -203,7 +203,7 @@ bool(false)
 bool(false)
 > Offset: 12
 
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
 bool(false)
 > Offset: -1
 int(8)
@@ -213,7 +213,7 @@ int(8)
 int(4)
 > Offset: -20
 
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
 bool(false)
 
 ------- mb_strripos -----------
index c2f29baec77323759235847c87484c2de549ea72..c3e9660e23fa2a708f2b906901a72969bcc91e95 100644 (file)
@@ -1989,14 +1989,14 @@ PHP_FUNCTION(strrpos)
 
        if (offset >= 0) {
                if ((size_t)offset > ZSTR_LEN(haystack)) {
-                       php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+                       php_error_docref(NULL, E_WARNING, "Offset not contained in string");
                        RETURN_FALSE;
                }
                p = ZSTR_VAL(haystack) + (size_t)offset;
                e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
        } else {
                if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
-                       php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+                       php_error_docref(NULL, E_WARNING, "Offset not contained in string");
                        RETURN_FALSE;
                }
                p = ZSTR_VAL(haystack);
@@ -2042,7 +2042,7 @@ PHP_FUNCTION(strripos)
                char lowered;
                if (offset >= 0) {
                        if ((size_t)offset > ZSTR_LEN(haystack)) {
-                               php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+                               php_error_docref(NULL, E_WARNING, "Offset not contained in string");
                                RETURN_FALSE;
                        }
                        p = ZSTR_VAL(haystack) + (size_t)offset;
@@ -2050,7 +2050,7 @@ PHP_FUNCTION(strripos)
                } else {
                        p = ZSTR_VAL(haystack);
                        if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
-                               php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+                               php_error_docref(NULL, E_WARNING, "Offset not contained in string");
                                RETURN_FALSE;
                        }
                        e = ZSTR_VAL(haystack) + (ZSTR_LEN(haystack) + (size_t)offset);
@@ -2070,7 +2070,7 @@ PHP_FUNCTION(strripos)
        if (offset >= 0) {
                if ((size_t)offset > ZSTR_LEN(haystack)) {
                        zend_string_release_ex(haystack_dup, 0);
-                       php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+                       php_error_docref(NULL, E_WARNING, "Offset not contained in string");
                        RETURN_FALSE;
                }
                p = ZSTR_VAL(haystack_dup) + offset;
@@ -2078,7 +2078,7 @@ PHP_FUNCTION(strripos)
        } else {
                if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
                        zend_string_release_ex(haystack_dup, 0);
-                       php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
+                       php_error_docref(NULL, E_WARNING, "Offset not contained in string");
                        RETURN_FALSE;
                }
                p = ZSTR_VAL(haystack_dup);
index 26ea5bc7704bc18ec114c2e0b68bdc81c885b6a9..d502bff829e27869113df5721909f1b70d24c081 100644 (file)
@@ -53,10 +53,10 @@ bool(false)
 Warning: stripos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
 bool(false)
 int(2)
 string(8) "abcdeabc"
index 5981c9b6cb3199f2aca02d7a36b5f81494736719..7dc0ce0d61dd0839fe7e9d0a303c38f0dc074afa 100644 (file)
@@ -19,15 +19,15 @@ echo "Done\n";
 --EXPECTF--
 strripos() expects parameter 3 to be int, float given
 
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strripos(): Offset not contained in string in %s on line %d
 bool(false)
 Done
index d1bbc856a322bc8a1eaa1ffd3a85c031c10b9af2..fdff39fdb2446d9689794a1f6d5c85938b4c326e 100644 (file)
@@ -19,15 +19,15 @@ echo "Done\n";
 --EXPECTF--
 strrpos() expects parameter 3 to be int, float given
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 
-Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
+Warning: strrpos(): Offset not contained in string in %s on line %d
 bool(false)
 Done