ID: 46893
Updated by: [email protected]
-Summary: extract($foo) fails silently if $foo['foo'] exists
Reported By: steffen dot weber at gmail dot com
-Status: Open
+Status: Verified
-Bug Type: Arrays related
+Bug Type: Reproducible crash
-Operating System: Gentoo Linux x86_64
+Operating System: *
-PHP Version: 5.2.8
+PHP Version: 5CVS, 6CVS (2008-12-18)
New Comment:
It fails "silently" because it crashes. :)
#0 0x083437ad in _zend_is_inconsistent (ht=0x1, file=0x85ffca4
"/home/jani/src/php-5.2/Zend/zend_hash.c", line=1083)
at /home/jani/src/php-5.2/Zend/zend_hash.c:53
#1 0x083465be in zend_hash_move_forward_ex (ht=0x1, pos=0xbfffcd98) at
/home/jani/src/php-5.2/Zend/zend_hash.c:1083
#2 0x082435a0 in zif_extract (ht=1, return_value=0x86e16f8,
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0)
at /home/jani/src/php-5.2/ext/standard/array.c:1491
#3 0x0835e8bf in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfffcfa8)
at /home/jani/src/php-5.2/Zend/zend_vm_execute.h:200
#4 0x083641f9 in ZEND_DO_FCALL_SPEC_CONST_HANDLER
(execute_data=0xbfffcfa8)
at /home/jani/src/php-5.2/Zend/zend_vm_execute.h:1729
#5 0x0835e43c in execute (op_array=0x86e1088) at
/home/jani/src/php-5.2/Zend/zend_vm_execute.h:92
#6 0x083397aa in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/jani/src/php-5.2/Zend/zend.c:1134
#7 0x082e831a in php_execute_script (primary_file=0xbffff324) at
/home/jani/src/php-5.2/main/main.c:2023
#8 0x083b4bc9 in main (argc=2, argv=0xbffff464) at
/home/jani/src/php-5.2/sapi/cli/php_cli.c:1133
Previous Comments:
------------------------------------------------------------------------
[2008-12-17 23:06:57] steffen dot weber at gmail dot com
Description:
------------
Execute the following script and observe that $bar is set to a random
integer (*). Furthermore $test is not set at all. This problem did not
occur with PHP 5.2.6.
(*) Could this have security implications?
Reproduce code:
---------------
<?php
$foo = array('foo' => 1, 'bar' => 2, 'test' => 3);
extract($foo);
var_dump($foo, $bar, $test);
?>
Expected result:
----------------
int(1)
int(2)
int(3)
Actual result:
--------------
Notice: Undefined variable: test in extract-bug.php on line 4
int(1)
int(RANDOM_NUMBER)
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46893&edit=1