#24860 [Fbk->Csd]: register_shutdown_function param doesn't take array(obj, method)
ID: 24860
User updated by: tom at minnesota dot com
Reported By: tom at minnesota dot com
-Status: Feedback
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: NetBSD/Alpha (64bit) - 1.6
PHP Version: 4.3.2
New Comment:
php4-STABLE-200307300130 worked.
Previous Comments:
------------------------------------------------------------------------
[2003-07-29 19:40:14] pollita@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Works fine here with the exact code you pasted. Please try the
snapshot indicated above.
------------------------------------------------------------------------
[2003-07-29 17:16:09] tom at minnesota dot com
Description:
------------
It seems like register_shutdown_function doesn't take a param of
array(obj, method):
register_shutdown_function(array(&$this, 'MyDestructor'));
---
Fails with this error:
Warning: Unknown(): Unable to call Array() - function does not exist in
Unknown on line 0.
Reproduce code:
---------------
<?php
class Object {
var $somevar = "foo";
function Object() {
$somevar = "bar";
register_shutdown_function(array(&$this, 'MyDestructor'));
}
function MyDestructor() {
# Do useful destructor stuff here...
}
}
# Now create the object as follows and then 'MyDestructor'
# will be called on shutdown and will be able to operate on
# the object as it ended up... not as it started!
$my_object =& new Object;
?>
Expected result:
----------------
Pseudo destructor to perform properly with register_shutdown_function
taking an array(obj, method).
Actual result:
--------------
Warning: Unknown(): Unable to call Array() - function does not exist in
Unknown on line 0.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24860&edit=1
Thread (3 messages)