From: Moriyoshi Koizumi Date: Tue, 10 Aug 2004 06:04:12 +0000 (+0000) Subject: - MFH: Bugfix #29493 (extract(array, EXTR_REFS) misbehaves with elements X-Git-Tag: php-4.3.9RC1~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de231c928c71c9956dcc118663a814ccc3625fcc;p=php - MFH: Bugfix #29493 (extract(array, EXTR_REFS) misbehaves with elements referred twice or more times) --- diff --git a/NEWS b/NEWS index 1e0ae3fc4d..916b80ea99 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP 4 NEWS - NSAPI: added "bucket" parameter to list of non-php.ini-keys of php4_execute for doing performance stats without warnings in server-log. (Uwe Schindler) - Fixed bug #29581 (Typo inside php.ini comments for mysql.trace_mode). (Ilia) +- Fixed bug #29493 (extract(array, EXTR_REFS) misbehaves with elements + referred twice or more times). (Moriyoshi) - Fixed bug #29443 (Sanity check for wbmp detection). (Ilia) - Fixed bug #29369 (Uploaded files with ' or " in their names get their names truncated at those characters). (Ilia) diff --git a/ext/standard/array.c b/ext/standard/array.c index 2f9725c723..d85fc33aa0 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1290,13 +1290,16 @@ PHP_FUNCTION(extract) if (extract_refs) { zval **orig_var; - SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); - zval_add_ref(entry); - if (zend_hash_find(EG(active_symbol_table), final_name.c, final_name.len+1, (void **) &orig_var) == SUCCESS) { zval_ptr_dtor(orig_var); + + SEPARATE_ZVAL_TO_MAKE_IS_REF(entry); + zval_add_ref(entry); + *orig_var = *entry; } else { + (*entry)->is_ref = 1; + zval_add_ref(entry); zend_hash_update(EG(active_symbol_table), final_name.c, final_name.len+1, (void **) entry, sizeof(zval *), NULL); } } else {