#47409 [Opn->Fbk]: extract() problem
ID: 47409
Updated by: jani@php.net
Reported By: niximor at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Windows Vista
PHP Version: 5.2.9RC2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2009-02-16 18:48:50] niximor at gmail dot com
Description:
------------
When I use extract() with array, that contains key "this", it behaves
really weird. See code for more info.
Reproduce code:
---------------
class Test1 {
var $name = "test1";
}
class Test2 {
var $name = "test2";
function bug() {
extract(array("this"=>new Test1()), EXTR_OVERWRITE | EXTR_REFS);
echo get_class($this)."::name = ".$this->name;
}
}
$t = new Test2();
$t->bug();
Expected result:
----------------
Test1::name = test1 (preferably)
OR
Test2::name = test2
- not combination of both.
Actual result:
--------------
Test1::name = test2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47409&edit=1
Thread (5 messages)