|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-11-02 12:41 UTC] jani@php.net
[2008-11-10 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 10:00:01 2025 UTC |
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