cvs: php4 /ext/pcre php_pcre.c /ext/standard string.c
| From: | Ilia Alshanetsky | Date: | Sun, 25 May 2003 21:48:57 +0000 |
| Subject: | cvs: php4 /ext/pcre php_pcre.c /ext/standard string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-21261@lists.php.net to get a copy of this message | ||
iliaa Sun May 25 17:48:57 2003 EDT
Modified files:
/php4/ext/standard string.c
/php4/ext/pcre php_pcre.c
Log:
Fixed bug #23788 (str|preg_replace clober the array elements).
# Should this be MFBed to 4.3 branch?
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.385 php4/ext/standard/string.c:1.386
--- php4/ext/standard/string.c:1.385 Wed May 21 13:44:08 2003
+++ php4/ext/standard/string.c Sun May 25 17:48:57 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.385 2003/05/21 17:44:08 sterling Exp $ */
+/* $Id: string.c,v 1.386 2003/05/25 21:48:57 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -3166,6 +3166,7 @@
while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS)
{
if (Z_TYPE_PP(subject_entry) != IS_ARRAY && Z_TYPE_PP(subject_entry) != IS_OBJECT) {
MAKE_STD_ZVAL(result);
+ SEPARATE_ZVAL(subject_entry);
php_str_replace_in_subject(*search, *replace, subject_entry, result, case_sensitivity, (argc
> 3) ? &count : NULL);
} else {
result = *subject_entry;
Index: php4/ext/pcre/php_pcre.c
diff -u php4/ext/pcre/php_pcre.c:1.140 php4/ext/pcre/php_pcre.c:1.141
--- php4/ext/pcre/php_pcre.c:1.140 Tue May 20 14:11:09 2003
+++ php4/ext/pcre/php_pcre.c Sun May 25 17:48:57 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pcre.c,v 1.140 2003/05/20 18:11:09 andrei Exp $ */
+/* $Id: php_pcre.c,v 1.141 2003/05/25 21:48:57 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1082,6 +1082,7 @@
/* For each subject entry, convert it to string, then perform replacement
and add the result to the return_value array. */
while (zend_hash_get_current_data(Z_ARRVAL_PP(subject), (void **)&subject_entry) == SUCCESS)
{
+ SEPARATE_ZVAL(subject_entry);
if ((result = php_replace_in_subject(*regex, *replace, subject_entry, &result_len,
limit_val, is_callable_replace TSRMLS_CC)) != NULL) {
/* Add to return array */
switch(zend_hash_get_current_key(Z_ARRVAL_PP(subject), &string_key, &num_key, 0))