note 60394 added to function.set-error-handler

From: Date: Thu, 05 Jan 2006 17:36:23 +0000
Subject: note 60394 added to function.set-error-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-101259@lists.php.net to get a copy of this message
Also note that even though the documentation states "errcontext will contain an array of every variable that existed in the scope the error was triggered in," that is not the case for $this in an instantiated object, as of PHP 5.1.1. <?php function error_function($errno, $errstr, $errfile, $errline, $errcontext) { print_r($errcontext); } set_error_handler('error_function'); class test_class { private $id; function __construct($id) { $this->id = $id; trigger_error('Test error'); } } $test = new test_class(5); ?> Result: Array ( [id] => 5 ) I discovered this when trying to write an error handler that would log the class the error occured in, as it was triggered from a function in a parent class extended by several individual classes. ---- Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60394 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60394&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60394&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60394&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60394&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60394&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60394&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60394&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60394&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#101259) next »