Skip to content

Commit 0b76865

Browse files
committed
Merge branch 'master' of git.php.net:/php-src
2 parents ba138a3 + 7ef8e3f commit 0b76865

File tree

4 files changed

+47
-19
lines changed

4 files changed

+47
-19
lines changed

ext/standard/array.c

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3100,14 +3100,10 @@ static void php_splice(HashTable *in_hash, zend_long offset, zend_long length, H
31003100
p = in_hash->arData + idx;
31013101
if (Z_TYPE(p->val) == IS_UNDEF) continue;
31023102
pos2++;
3103-
if (p->key == NULL) {
3104-
zend_hash_del_bucket(in_hash, p);
3103+
if (p->key && in_hash == &EG(symbol_table)) {
3104+
zend_delete_global_variable(p->key);
31053105
} else {
3106-
if (in_hash == &EG(symbol_table)) {
3107-
zend_delete_global_variable(p->key);
3108-
} else {
3109-
zend_hash_del_bucket(in_hash, p);
3110-
}
3106+
zend_hash_del_bucket(in_hash, p);
31113107
}
31123108
}
31133109
}
@@ -3231,12 +3227,8 @@ PHP_FUNCTION(array_pop)
32313227
}
32323228

32333229
/* Delete the last value */
3234-
if (p->key) {
3235-
if (Z_ARRVAL_P(stack) == &EG(symbol_table)) {
3236-
zend_delete_global_variable(p->key);
3237-
} else {
3238-
zend_hash_del_bucket(Z_ARRVAL_P(stack), p);
3239-
}
3230+
if (p->key && Z_ARRVAL_P(stack) == &EG(symbol_table)) {
3231+
zend_delete_global_variable(p->key);
32403232
} else {
32413233
zend_hash_del_bucket(Z_ARRVAL_P(stack), p);
32423234
}
@@ -3281,12 +3273,8 @@ PHP_FUNCTION(array_shift)
32813273
ZVAL_COPY_DEREF(return_value, val);
32823274

32833275
/* Delete the first value */
3284-
if (p->key) {
3285-
if (Z_ARRVAL_P(stack) == &EG(symbol_table)) {
3286-
zend_delete_global_variable(p->key);
3287-
} else {
3288-
zend_hash_del_bucket(Z_ARRVAL_P(stack), p);
3289-
}
3276+
if (p->key && Z_ARRVAL_P(stack) == &EG(symbol_table)) {
3277+
zend_delete_global_variable(p->key);
32903278
} else {
32913279
zend_hash_del_bucket(Z_ARRVAL_P(stack), p);
32923280
}

ext/standard/tests/strings/strripos_offset.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,16 @@ bool(false)
3333
Warning: strripos() expects parameter 1 to be string, array given in %s on line %d
3434
bool(false)
3535

36+
Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
37+
3638
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
3739
bool(false)
3840

3941
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
4042
bool(false)
4143

44+
Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
45+
4246
Warning: strripos(): Offset is greater than the length of haystack string in %s on line %d
4347
bool(false)
4448

ext/standard/tests/strings/strrpos_offset.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ bool(false)
2929
Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
3030
bool(false)
3131

32+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
33+
3234
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
3335
bool(false)
3436

3537
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
3638
bool(false)
3739

40+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
41+
3842
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
3943
bool(false)
4044

ext/standard/tests/strings/strrpos_variation15.phpt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,32 +91,48 @@ echo "*** Done ***";
9191
--EXPECTF--
9292
*** Testing strrpos() function: with unexpected values for haystack, needle & offset ***
9393
-- Iteration 1 --
94+
95+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
9496
bool(false)
9597
-- Iteration 2 --
98+
99+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
96100
bool(false)
97101
-- Iteration 3 --
98102

103+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
104+
99105
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
100106
bool(false)
101107
-- Iteration 4 --
102108

109+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
110+
103111
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
104112
bool(false)
105113
-- Iteration 5 --
106114

115+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
116+
107117
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
108118
bool(false)
109119
-- Iteration 6 --
110120

121+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
122+
111123
Warning: strrpos(): Offset is greater than the length of haystack string in %s on line %d
112124
bool(false)
113125
-- Iteration 7 --
114126

115127
Warning: strrpos() expects parameter 3 to be int, float given in %s on line %d
116128
bool(false)
117129
-- Iteration 8 --
130+
131+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
118132
bool(false)
119133
-- Iteration 9 --
134+
135+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
120136
bool(false)
121137
-- Iteration 10 --
122138

@@ -139,12 +155,20 @@ bool(false)
139155
Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d
140156
bool(false)
141157
-- Iteration 15 --
158+
159+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
142160
bool(false)
143161
-- Iteration 16 --
162+
163+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
144164
bool(false)
145165
-- Iteration 17 --
166+
167+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
146168
bool(false)
147169
-- Iteration 18 --
170+
171+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
148172
bool(false)
149173
-- Iteration 19 --
150174

@@ -159,15 +183,23 @@ bool(false)
159183
Warning: strrpos() expects parameter 3 to be int, string given in %s on line %d
160184
bool(false)
161185
-- Iteration 22 --
186+
187+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
162188
bool(false)
163189
-- Iteration 23 --
190+
191+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
164192
bool(false)
165193
-- Iteration 24 --
166194

167195
Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d
168196
bool(false)
169197
-- Iteration 25 --
198+
199+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
170200
bool(false)
171201
-- Iteration 26 --
202+
203+
Deprecated: strrpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in %s on line %d
172204
bool(false)
173205
*** Done ***

0 commit comments

Comments
 (0)