Re: 4.1.0rc2 register_shutdown_function

From: Date: Thu, 15 Nov 2001 18:42:42 +0000
Subject: Re: 4.1.0rc2 register_shutdown_function
References: 1  Groups: php.qa 
Request: Send a blank email to php-qa+get-3866@lists.php.net to get a copy of this message
ben woodhead writes: > Hello Everybody > > have been looking at register_shutdown_function() inside a class and it works > fine with 4.0.x, but does not work in 4.1.0rc2... Am I doing something wrong > or is it a bug.. It seems to be descructing the class before it runs the > function, causing this error: > > Warning: Unable to call (null)() - function does not exist in Unknown on line > 0 > > There is the class > > Thanks Ben First, this is the Quality Assurance list, not the Question/Answer list. :) You'll have a much easier time finding answers on php-general. Secondly, register_shutdown_function() takes a string argument, which is the name of the function (not class method) which is to be executed on shutdown. At the moment, you're calling it with whatever the return value of '$this->destroyObject()' is, which is nothing. In any case, if you put error_reporting(E_ALL) near the beginning of the file, you should get an 'undefined property' error on the line that calls register_shutdown_function(), since $this->destroyObject is not a class method or property ($this->destroyObject() is). Replacing $this->destroyObject with $this->destroyObject() on that line results in the warning you noted, since you've registered a null function to execute on shutdown. Don't know why it would have appeared to work for you--it doesn't work for me (either way) on 4.0.7-dev. I am afraid I don't have time to rewrite this correctly, but again, asking on the php general discussion list should get you some more helpful help. :) Cheers, Torben -- Torben Wilson <torben@php.net> http://www.thebuttlesschaps.com +1.604.709.0506

« previous php.qa (#3866) next »