ID: 34344
User updated by: thomas at ecommerce dot com
Reported By: thomas at ecommerce dot com
Status: Open
Bug Type: SPL related
Operating System: SuSE Linux
PHP Version: 5.0.4
New Comment:
Updated Expected result part
Previous Comments:
------------------------------------------------------------------------
[2005-09-02 12:48:51] thomas at ecommerce dot com
Description:
------------
When trying to call the register_shutdown_function() inside class like
this:
register_shutdown_function(array(&$this, "_log"));
and the method _log() is a private method it don't work. We assign
$this here to the function so
register_shutdown_function() should be allowed to call a private
function inside of the class or at least throw allready here an error
message when this function is called and _log() is a private function.
Its also not documented that this wouldn't work....
Reproduce code:
---------------
<?php
final class TestClass
{
public function TestClass()
{
echo "Class init call!\n";
$this->_init();
}
private function _init()
{
echo "Registrering shutdown function..\n";
//-- register log function
register_shutdown_function(array(&$this, "_log"));
echo "done\n";
}
private function _log()
{
//-- send mail
mail("[EMAIL PROTECTED]", "subject", "content");
}
}
echo "Script start! Init Class.\n";
$TestClass = new TestClass();
echo "Class inited!\n";
Expected result:
----------------
email will be send to [EMAIL PROTECTED] when script is done.
Actual result:
--------------
Script will not call the shutdown function
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34344&edit=1