note 82295 deleted from function.set-error-handler by sobak
| From: | sobak@php.net | Date: | Sun, 24 Aug 2014 09:35:58 +0000 |
| Subject: | note 82295 deleted from function.set-error-handler by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200299@lists.php.net to get a copy of this message | ||
Note Submitter: Alexey Letoshnikov
----
There is a problem to set a static function as error handler
<?php
class Debug
{
public static function test($num,$err,$file,$line)
{
return true;
}
}
?>
<?php set_error_handler(array(Debug,'test')); ?>
Static function accepted by set_error_handler() and works but php generates E_NOTICE "Use of
undefined constant Debug"
<?php set_error_handler('Debug::test')); ?>
Static function accepted by set_error_handler but does not work
Finaly decided to create a __construct() method and set it as error handler.
<?php set_error_handler(array(new Debug(),'test')); ?>