Advertising
- robin
- Tuesday, February 19th, 2008 at 1:04:48pm MST
- diff -Naur php6.0-200802191530.orig\ext\standard/array.c php6.0-200802191530\ext\standard/array.c
- --- php6.0-200802191530.orig\ext\standard/array.c 2008-02-15 11:30:22.000000000 +0000
- +++ php6.0-200802191530\ext\standard/array.c 2008-02-19 19:11:16.046875000 +0000
- @@ -1509,18 +1509,13 @@
- if (extract_refs) {
- zval **orig_var;
- + SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);
- + zval_add_ref(entry);
- +
- if (zend_u_hash_find(EG(active_symbol_table), Z_TYPE(final_name), Z_UNIVAL(final_name), Z_UNILEN(final_name) + 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 (Z_REFCOUNT_P(var_array) > 1 || *entry == EG(uninitialized_zval_ptr)) {
- - SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);
- - } else {
- - Z_SET_ISREF_PP(entry);
- - }
- - zval_add_ref(entry);
- zend_u_hash_update(EG(active_symbol_table), Z_TYPE(final_name), Z_UNIVAL(final_name), Z_UNILEN(final_name) + 1, (void **) entry, sizeof(zval *), NULL);
- }
- } else {
- diff -Naur php6.0-200802191530.orig\ext\standard/basic_functions.c php6.0-200802191530\ext\standard/basic_functions.c
- --- php6.0-200802191530.orig\ext\standard/basic_functions.c 2008-02-03 15:23:22.000000000 +0000
- +++ php6.0-200802191530\ext\standard/basic_functions.c 2008-02-19 18:44:20.656250000 +0000
- @@ -368,7 +368,7 @@
- static
- ZEND_BEGIN_ARG_INFO_EX(arginfo_extract, 0, 0, 1)
- - ZEND_ARG_INFO(0, arg) /* ARRAY_INFO(0, arg, 0) */
- + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) /* ARRAY_INFO(0, arg, 0) */
- ZEND_ARG_INFO(0, extract_type)
- ZEND_ARG_INFO(0, prefix)
- ZEND_END_ARG_INFO()
- diff -Naur php6.0-200802191530.orig\ext\standard/tests/array/extract_variation10.phpt php6.0-200802191530\ext\standard/tests/array/extract_variation10.phpt
- --- php6.0-200802191530.orig\ext\standard/tests/array/extract_variation10.phpt 1970-01-01 00:00:00.000000000 +0000
- +++ php6.0-200802191530\ext\standard/tests/array/extract_variation10.phpt 2008-02-19 19:29:17.078125000 +0000
- @@ -0,0 +1,15 @@
- +--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--
- +string(12) "original.foo"
- +--UEXPECTF--
- +unicode(12) "original.foo"
- \ No newline at end of file
- diff -Naur php6.0-200802191530.orig\ext\standard/tests/array/extract_variation11.phpt php6.0-200802191530\ext\standard/tests/array/extract_variation11.phpt
- --- php6.0-200802191530.orig\ext\standard/tests/array/extract_variation11.phpt 1970-01-01 00:00:00.000000000 +0000
- +++ php6.0-200802191530\ext\standard/tests/array/extract_variation11.phpt 2008-02-19 19:29:27.375000000 +0000
- @@ -0,0 +1,15 @@
- +--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--
- +string(11) "changed.foo"
- +--UEXPECTF--
- +unicode(11) "changed.foo"
- \ No newline at end of file
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.