inconsistent results). (Arnaud)
- Fixed bug #46626 (mb_convert_case does not handle apostrophe correctly).
(Ilia)
+- Fixed bug #44182 (extract($a, EXTR_REFS) can fail to split copy-on-write
+ references). (robin_fernandes at uk dot ibm dot com)
+- Fixed bug #44181 (extract($a, EXTR_OVERWRITE|EXTR_REFS) can fail to create
+ references to $a). (robin_fernandes at uk dot ibm dot com)
20 Nov 2008, PHP 5.2.7RC4
- Added logging option for error_log to send directly to SAPI. (Stas)
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) {
- SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);
- zval_add_ref(entry);
-
zval_ptr_dtor(orig_var);
-
*orig_var = *entry;
} else {
- if ((*var_array)->refcount > 1 || *entry == EG(uninitialized_zval_ptr)) {
- SEPARATE_ZVAL_TO_MAKE_IS_REF(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 {
--- /dev/null
+--TEST--
+Test extract() function - ensure EXTR_REFS doesn't mess with isRef flag on COW references to array elements.
+--FILE--
+<?php
+$a = array('foo' => 'original.foo');
+$nonref = $a['foo'];
+$ref = &$a;
+extract($a, EXTR_REFS);
+$a['foo'] = 'changed.foo';
+var_dump($nonref);
+?>
+--EXPECTF--
+%unicode|string%(12) "original.foo"
--- /dev/null
+--TEST--
+Test extract() function - ensure EXTR_REFS works when array is referenced and keys clash with variables in current scope.
+--FILE--
+<?php
+$a = array('foo' => 'original.foo');
+$ref = &$a;
+$foo = 'test';
+extract($a, EXTR_OVERWRITE|EXTR_REFS);
+$foo = 'changed.foo';
+var_dump($a['foo']);
+?>
+--EXPECTF--
+%unicode|string%(11) "changed.foo"