From: thomas at ecommerce dot com
Operating system: SuSE Linux
PHP version: 5.0.4
PHP Bug Type: SPL related
Bug description: register_shutdown_function() in classes
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 bug report at http://bugs.php.net/?id=34344&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34344&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34344&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34344&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34344&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34344&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34344&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34344&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34344&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34344&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34344&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34344&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34344&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34344&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34344&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34344&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34344&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34344&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34344&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34344&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34344&r=mysqlcfg