]> granicus.if.org Git - php/commitdiff
Fixed bug #71178 (preg_replace with arrays creates [0] in replace array if not alread...
authorXinchen Hui <laruence@gmail.com>
Mon, 21 Dec 2015 10:09:59 +0000 (18:09 +0800)
committerXinchen Hui <laruence@gmail.com>
Mon, 21 Dec 2015 10:10:48 +0000 (18:10 +0800)
NEWS
ext/pcre/php_pcre.c

diff --git a/NEWS b/NEWS
index c0aa2e779a9aadd1ce40c284be762d12bb9e1d16..9b6f8b9076af248ffbc3066218a12205a3500e78 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,10 @@ PHP                                                                        NEWS
 - Opcache:
   . Fixed bug #71127 (Define in auto_prepend_file is overwrite). (Laruence)
 
+- PCRE:
+  . Fixed bug #71178 (preg_replace with arrays creates [0] in replace array
+    if not already set). (Laruence)
+
 - Readline:
   . Fixed bug #71094 (readline_completion_function corrupts static array on
     second TAB). (Nikita)
index 66ee238dc4b55e1814668813e4282f64e4b5944c..6769eb7d9ac9695599b8b3290fffd1cf5acabe97 100644 (file)
@@ -1380,7 +1380,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub
                                /* Get current entry */
                                replace_entry = NULL;
                                while (replace_idx < Z_ARRVAL_P(replace)->nNumUsed) {
-                                       if (Z_TYPE(Z_ARRVAL_P(replace)->arData[replace_idx].val) != IS_UNUSED) {
+                                       if (Z_TYPE(Z_ARRVAL_P(replace)->arData[replace_idx].val) != IS_UNDEF) {
                                                replace_entry = &Z_ARRVAL_P(replace)->arData[replace_idx].val;
                                                break;
                                        }