#36339 [Opn->Bgs]: register_shutdown_function and &$this

From: Date: Thu, 09 Feb 2006 13:38:01 +0000
Subject: #36339 [Opn->Bgs]: register_shutdown_function and &$this
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93070@lists.php.net to get a copy of this message
 ID:               36339
 Updated by:       tony2001@php.net
 Reported By:      ni dot ki dot ta at mail dot ru
-Status:           Open
+Status:           Bogus
-Bug Type:         *General Issues
+Bug Type:         Unknown/Other Function
 Operating System: Linux
 PHP Version:      4.4.2
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

In PHP4 you have to use $obj = &new A; to prevent objects from copying.


Previous Comments:
------------------------------------------------------------------------

[2006-02-09 14:23:17] ni dot ki dot ta at mail dot ru

Description:
------------
Is it possible to use
register_shutdown_function(array(&$this,"Destructor")) inside other
function?

Reproduce code:
---------------
class A {
	var $val = "A";

	function A() {
		register_shutdown_function(array(&$this,"Destructor"));
			$this->val = "B";
		}

		function Destructor() {
			print $this->val;
			print $GLOBALS["obj"]->val;
		}
	}

	$obj = new A;
	$obj->val = "C";

Expected result:
----------------
CC

Actual result:
--------------
BC


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36339&edit=1


Thread (2 messages)

« previous php.bugs (#93070) next »