summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-07-02 22:31:52 +0200
committerNikita Popov <nikic@php.net>2014-07-02 22:33:20 +0200
commit3cc6bd10acdec14dc28bce1f39689bc99add4514 (patch)
tree1dfbff09b9dc74f362e2dddb878ab7a9fcdd0a33
parent5efda71e54e11c91d567e14bbc00d299c5e8764c (diff)
downloadphp-git-3cc6bd10acdec14dc28bce1f39689bc99add4514.tar.gz
Fix bug #67151: strtr with empty array crashes
-rw-r--r--NEWS1
-rw-r--r--ext/standard/string.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index ccc90277ba..44196a3e1a 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ PHP NEWS
match). (Bob)
. Fixed bug #67091 (make install fails to install libphp5.so on FreeBSD 10.0).
(Ferenc)
+ . Fixed bug #67151 (strtr with empty array crashes). (Nikita)
- CLI server:
. Implemented FR #67429 (CLI server is missing some new HTTP response codes).
diff --git a/ext/standard/string.c b/ext/standard/string.c
index c4e77f2f29..22b1957f1e 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -3155,6 +3155,10 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *
int patterns_len;
zend_llist *allocs;
+ if (zend_hash_num_elements(pats) == 0) {
+ RETURN_STRINGL(str, slen, 1);
+ }
+
S(&text) = str;
L(&text) = slen;