Skip to content

Commit 3cc6bd1

Browse files
committed
Fix bug #67151: strtr with empty array crashes
1 parent 5efda71 commit 3cc6bd1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PHP NEWS
99
match). (Bob)
1010
. Fixed bug #67091 (make install fails to install libphp5.so on FreeBSD 10.0).
1111
(Ferenc)
12+
. Fixed bug #67151 (strtr with empty array crashes). (Nikita)
1213

1314
- CLI server:
1415
. Implemented FR #67429 (CLI server is missing some new HTTP response codes).

ext/standard/string.c

+4
Original file line numberDiff line numberDiff line change
@@ -3155,6 +3155,10 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *
31553155
int patterns_len;
31563156
zend_llist *allocs;
31573157

3158+
if (zend_hash_num_elements(pats) == 0) {
3159+
RETURN_STRINGL(str, slen, 1);
3160+
}
3161+
31583162
S(&text) = str;
31593163
L(&text) = slen;
31603164

0 commit comments

Comments
 (0)