Skip to content

Commit ab76c61

Browse files
committed
Normalise strr(i)pos offset messages with str(i)pos ones.
1 parent 70fa43e commit ab76c61

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

ext/mbstring/tests/bug43841.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Warning: mb_strrpos(): Offset is greater than the length of haystack string in %
4646
bool(false)
4747
strrpos:
4848

49-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
49+
Warning: strrpos(): Offset not contained in string in %s on line %d
5050
bool(false)
5151

5252
-- Offset is -24 --
@@ -61,7 +61,7 @@ Warning: mb_strrpos(): Offset is greater than the length of haystack string in %
6161
bool(false)
6262
strrpos:
6363

64-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
64+
Warning: strrpos(): Offset not contained in string in %s on line %d
6565
bool(false)
6666

6767
-- Offset is -13 --

ext/mbstring/tests/bug45923.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ bool(false)
149149
bool(false)
150150
> Offset: 12
151151

152-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
152+
Warning: strrpos(): Offset not contained in string in %s on line %d
153153
bool(false)
154154
> Offset: -1
155155
int(8)
@@ -159,7 +159,7 @@ int(8)
159159
int(4)
160160
> Offset: -20
161161

162-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
162+
Warning: strrpos(): Offset not contained in string in %s on line %d
163163
bool(false)
164164

165165
------- mb_strrpos -----------
@@ -203,7 +203,7 @@ bool(false)
203203
bool(false)
204204
> Offset: 12
205205

206-
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
206+
Warning: strripos(): Offset not contained in string in %s on line %d
207207
bool(false)
208208
> Offset: -1
209209
int(8)
@@ -213,7 +213,7 @@ int(8)
213213
int(4)
214214
> Offset: -20
215215

216-
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
216+
Warning: strripos(): Offset not contained in string in %s on line %d
217217
bool(false)
218218

219219
------- mb_strripos -----------

ext/standard/string.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,14 +1989,14 @@ PHP_FUNCTION(strrpos)
19891989

19901990
if (offset >= 0) {
19911991
if ((size_t)offset > ZSTR_LEN(haystack)) {
1992-
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
1992+
php_error_docref(NULL, E_WARNING, "Offset not contained in string");
19931993
RETURN_FALSE;
19941994
}
19951995
p = ZSTR_VAL(haystack) + (size_t)offset;
19961996
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack);
19971997
} else {
19981998
if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
1999-
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
1999+
php_error_docref(NULL, E_WARNING, "Offset not contained in string");
20002000
RETURN_FALSE;
20012001
}
20022002
p = ZSTR_VAL(haystack);
@@ -2042,15 +2042,15 @@ PHP_FUNCTION(strripos)
20422042
char lowered;
20432043
if (offset >= 0) {
20442044
if ((size_t)offset > ZSTR_LEN(haystack)) {
2045-
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
2045+
php_error_docref(NULL, E_WARNING, "Offset not contained in string");
20462046
RETURN_FALSE;
20472047
}
20482048
p = ZSTR_VAL(haystack) + (size_t)offset;
20492049
e = ZSTR_VAL(haystack) + ZSTR_LEN(haystack) - 1;
20502050
} else {
20512051
p = ZSTR_VAL(haystack);
20522052
if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
2053-
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
2053+
php_error_docref(NULL, E_WARNING, "Offset not contained in string");
20542054
RETURN_FALSE;
20552055
}
20562056
e = ZSTR_VAL(haystack) + (ZSTR_LEN(haystack) + (size_t)offset);
@@ -2070,15 +2070,15 @@ PHP_FUNCTION(strripos)
20702070
if (offset >= 0) {
20712071
if ((size_t)offset > ZSTR_LEN(haystack)) {
20722072
zend_string_release_ex(haystack_dup, 0);
2073-
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
2073+
php_error_docref(NULL, E_WARNING, "Offset not contained in string");
20742074
RETURN_FALSE;
20752075
}
20762076
p = ZSTR_VAL(haystack_dup) + offset;
20772077
e = ZSTR_VAL(haystack_dup) + ZSTR_LEN(haystack);
20782078
} else {
20792079
if (offset < -INT_MAX || (size_t)(-offset) > ZSTR_LEN(haystack)) {
20802080
zend_string_release_ex(haystack_dup, 0);
2081-
php_error_docref(NULL, E_WARNING, "Offset is greater than the length of haystack string");
2081+
php_error_docref(NULL, E_WARNING, "Offset not contained in string");
20822082
RETURN_FALSE;
20832083
}
20842084
p = ZSTR_VAL(haystack_dup);

ext/standard/tests/strings/bug40754.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ bool(false)
5353
Warning: stripos(): Offset not contained in string in %s on line %d
5454
bool(false)
5555

56-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
56+
Warning: strrpos(): Offset not contained in string in %s on line %d
5757
bool(false)
5858

59-
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
59+
Warning: strripos(): Offset not contained in string in %s on line %d
6060
bool(false)
6161
int(2)
6262
string(8) "abcdeabc"

ext/standard/tests/strings/strripos_offset.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ echo "Done\n";
1919
--EXPECTF--
2020
strripos() expects parameter 3 to be int, float given
2121

22-
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
22+
Warning: strripos(): Offset not contained in string in %s on line %d
2323
bool(false)
2424

25-
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
25+
Warning: strripos(): Offset not contained in string in %s on line %d
2626
bool(false)
2727

28-
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
28+
Warning: strripos(): Offset not contained in string in %s on line %d
2929
bool(false)
3030

31-
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
31+
Warning: strripos(): Offset not contained in string in %s on line %d
3232
bool(false)
3333
Done

ext/standard/tests/strings/strrpos_offset.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ echo "Done\n";
1919
--EXPECTF--
2020
strrpos() expects parameter 3 to be int, float given
2121

22-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
22+
Warning: strrpos(): Offset not contained in string in %s on line %d
2323
bool(false)
2424

25-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
25+
Warning: strrpos(): Offset not contained in string in %s on line %d
2626
bool(false)
2727

28-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
28+
Warning: strrpos(): Offset not contained in string in %s on line %d
2929
bool(false)
3030

31-
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
31+
Warning: strrpos(): Offset not contained in string in %s on line %d
3232
bool(false)
3333
Done

0 commit comments

Comments
 (0)