ID: 33792
User updated by: deadman_great at mail dot ru
-Reported By: deadman_great at wlp dot ru
+Reported By: deadman_great at mail dot ru
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: WinXP
PHP Version: 5.0.3
New Comment:
It's expected, but difficult for developers. It will be good if I can
make all dereferences inside destructor, but if I call
restore_error_handler(), apache crashes.
Previous Comments:
------------------------------------------------------------------------
[2005-07-21 02:16:36] [EMAIL PROTECTED]
Because usind set_error_handler() you create a reference to the object
and unset() only decrements reference count by 1, so the destructor
gets called at the end of request and not during unset() execution.
No bug here, it's expected.
------------------------------------------------------------------------
[2005-07-21 02:08:43] deadman_great at wlp dot ru
Change e-mail
------------------------------------------------------------------------
[2005-07-21 02:06:10] deadman_great at mail dot ru
Description:
------------
__destruct() not called on unset() if one of methods used as callback
for set_error_handler() function.
Reproduce code:
---------------
class Sample
{
function __construct() { set_error_hanlder(array(&$this,'OnError')); }
function __destruct () { echo '[DESTRUCT]'; }
function OnError ($a,$b,$c,$d) { echo 'Error'; }
}
$sample = new Sample();
echo '[BEFORE]';
unset($sample);
echo '[AFTER]';
Expected result:
----------------
[BEFORE][DESTRUCT][AFTER]
Actual result:
--------------
[BEFORE][AFTER][DESTRUCT]
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33792&edit=1