ID: 41186
Updated by: [EMAIL PROTECTED]
Reported By: ross dot lawley at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 5.2.1
-Assigned To:
+Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2007-04-25 14:27:19] ross dot lawley at gmail dot com
Description:
------------
ArrayObject::ARRAY_AS_PROPS fails to work in the __destruct method
Reproduce code:
---------------
<?php
class destructTest extends ArrayObject
{
public function __construct( )
{
$defaults = array('hello' => "world\n");
parent::__construct($defaults, ArrayObject::ARRAY_AS_PROPS);
}
public function say( )
{
echo $this->hello;
}
public function __destruct()
{
echo $this->hello;
}
}
$myArrayObject = new destructTest;
$myArrayObject->say();
// Lets destroy the object by reusing the variable
$myArrayObject = 1;
echo 'Test Completed';
?>
Expected result:
----------------
world
world
Test Completed
Actual result:
--------------
world
( ! ) Notice: Undefined property: destructTest::$hello in
/home/ross/www/tmp/arrayObject.php on line 18
Call Stack
# Time Memory Function Location
1 0.0002 60400 {main}( ) ../arrayObject.php:0
2 0.0003 61216 destructTest->__destruct( ) ../arrayObject.php:0
Test Completed
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41186&edit=1