note 108048 added to function.set-error-handler
| From: | qfox at ya dot ru | Date: | Sat, 24 Mar 2012 13:40:12 +0000 |
| Subject: | note 108048 added to function.set-error-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186805@lists.php.net to get a copy of this message | ||
Alexey.
<?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"
Yes, because if you need static call you must describe it correctly. Actually what is PHP did is
convert Debug (undefined constant) to "Debug" string. So the correct solution is:
<?php set_error_handler(array('Debug','test')); ?>
Afaik it must work in php since 5.3 or 5.4 version:
<?php set_error_handler('Debug::test'); ?>
Because of closure type. You can see a lot of examples how it works at page http://ru.php.net/manual/en/function.is-callable.php
----
Server IP: 69.147.83.197
Probable Submitter: 77.37.176.31
----
Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php
Edit -- https://master.php.net/note/edit/108048
Del: integrated -- https://master.php.net/note/delete/108048/integrated
Del: useless -- https://master.php.net/note/delete/108048/useless
Del: bad code -- https://master.php.net/note/delete/108048/bad+code
Del: spam -- https://master.php.net/note/delete/108048/spam
Del: non-english -- https://master.php.net/note/delete/108048/non-english
Del: in docs -- https://master.php.net/note/delete/108048/in+docs
Del: other reasons-- https://master.php.net/note/delete/108048
Reject -- https://master.php.net/note/reject/108048
Search -- https://master.php.net/manage/user-notes.php