com php-src: Fix bug #67151: strtr with empty array crashes: NEWS ext/standard/string.c
| From: | Nikita Popov | Date: | Wed, 02 Jul 2014 20:33:20 +0000 |
| Subject: | com php-src: Fix bug #67151: strtr with empty array crashes: NEWS ext/standard/string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79210@lists.php.net to get a copy of this message | ||
Commit: 3cc6bd10acdec14dc28bce1f39689bc99add4514
Author: Nikita Popov <nikic@php.net> Wed, 2 Jul 2014 22:31:52 +0200
Parents: 5efda71e54e11c91d567e14bbc00d299c5e8764c
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3cc6bd10acdec14dc28bce1f39689bc99add4514
Log:
Fix bug #67151: strtr with empty array crashes
Bugs:
https://bugs.php.net/67151
Changed paths:
M NEWS
M ext/standard/string.c
Diff:
diff --git a/NEWS b/NEWS
index ccc9027..44196a3 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 c4e77f2..22b1957 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;