From ab76c613fed4b05fac8496b40fbc0941ed25af30 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 22 Aug 2019 11:09:44 +0200 Subject: Normalise strr(i)pos offset messages with str(i)pos ones. --- ext/mbstring/tests/bug43841.phpt | 4 ++-- ext/mbstring/tests/bug45923.phpt | 8 ++++---- ext/standard/string.c | 12 ++++++------ ext/standard/tests/strings/bug40754.phpt | 4 ++-- ext/standard/tests/strings/strripos_offset.phpt | 8 ++++---- ext/standard/tests/strings/strrpos_offset.phpt | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ext/mbstring/tests/bug43841.phpt b/ext/mbstring/tests/bug43841.phpt index 01ae2a7525..ab52eb51c9 100644 --- a/ext/mbstring/tests/bug43841.phpt +++ b/ext/mbstring/tests/bug43841.phpt @@ -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 -- diff --git a/ext/mbstring/tests/bug45923.phpt b/ext/mbstring/tests/bug45923.phpt index eace49678c..6fc8e1db09 100644 --- a/ext/mbstring/tests/bug45923.phpt +++ b/ext/mbstring/tests/bug45923.phpt @@ -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 ----------- diff --git a/ext/standard/string.c b/ext/standard/string.c index c2f29baec7..c3e9660e23 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -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); diff --git a/ext/standard/tests/strings/bug40754.phpt b/ext/standard/tests/strings/bug40754.phpt index 26ea5bc770..d502bff829 100644 --- a/ext/standard/tests/strings/bug40754.phpt +++ b/ext/standard/tests/strings/bug40754.phpt @@ -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" diff --git a/ext/standard/tests/strings/strripos_offset.phpt b/ext/standard/tests/strings/strripos_offset.phpt index 5981c9b6cb..7dc0ce0d61 100644 --- a/ext/standard/tests/strings/strripos_offset.phpt +++ b/ext/standard/tests/strings/strripos_offset.phpt @@ -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 diff --git a/ext/standard/tests/strings/strrpos_offset.phpt b/ext/standard/tests/strings/strrpos_offset.phpt index d1bbc856a3..fdff39fdb2 100644 --- a/ext/standard/tests/strings/strrpos_offset.phpt +++ b/ext/standard/tests/strings/strrpos_offset.phpt @@ -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 -- cgit v1.2.1