com php-src: Fixed bug #71178 (preg_replace with arrays creates [0] in replace array if not alre ady set): NEWS ext/pcre/php_pcre.c
| From: | Xinchen Hui | Date: | Mon, 21 Dec 2015 10:10:48 +0000 |
| Subject: | com php-src: Fixed bug #71178 (preg_replace with arrays creates [0] in replace array if not alre ady set): NEWS ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90364@lists.php.net to get a copy of this message | ||
Commit: 817513af4ec5e5a45fdd7ecd0a00e728d00c3ff3
Author: Xinchen Hui <laruence@gmail.com> Mon, 21 Dec 2015 18:09:59 +0800
Parents: c85f569e5248893539c129e867896db56e1eff28
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=817513af4ec5e5a45fdd7ecd0a00e728d00c3ff3
Log:
Fixed bug #71178 (preg_replace with arrays creates [0] in replace array if not already set)
Bugs:
https://bugs.php.net/71178
Changed paths:
M NEWS
M ext/pcre/php_pcre.c
Diff:
diff --git a/NEWS b/NEWS
index c0aa2e7..9b6f8b9 100644
--- 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)
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 66ee238..6769eb7 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -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;
}