note 75169 added to function.set-error-handler
| From: | gregsidberry | Date: | Wed, 16 May 2007 05:32:09 +0000 |
| Subject: | note 75169 added to function.set-error-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126636@lists.php.net to get a copy of this message | ||
I was using a class, and needed to have a function within it handle php errors.
The following code will allow you to call a class function of already defined object while
maintaining access to all the objects current data .
============================
set_error_handler("classPassPHPError");
$ObjectName="test";
$test->new className;
function classPassPHPError($errno, $errstr, $errfile, $errline){
global $ObjectName;
eval("global \$".$ObjectName.";");
eval("\$object=\$".$ObjectName.";");
$object->phpErrorHandler($errno, $errstr, $errfile, $errline);
$object=null;
}
----
Server IP: 69.147.83.197
Probable Submitter: 24.89.103.157
----
Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php
Edit -- https://master.php.net/note/edit/75169
Del: integrated -- https://master.php.net/note/delete/75169/integrated
Del: useless -- https://master.php.net/note/delete/75169/useless
Del: bad code -- https://master.php.net/note/delete/75169/bad+code
Del: spam -- https://master.php.net/note/delete/75169/spam
Del: non-english -- https://master.php.net/note/delete/75169/non-english
Del: in docs -- https://master.php.net/note/delete/75169/in+docs
Del: other reasons-- https://master.php.net/note/delete/75169
Reject -- https://master.php.net/note/reject/75169
Search -- https://master.php.net/manage/user-notes.php