php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41186 ArrayObject::__desctruct ignores ARRAY_AS_PROPS
Submitted: 2007-04-25 14:27 UTC Modified: 2008-11-10 01:00 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ross dot lawley at gmail dot com Assigned: helly (profile)
Status: No Feedback Package: Class/Object related
PHP Version: 5.2.1 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-04-25 14:27 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-02 12:41 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-11-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC