php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19136 set_error_handler not working as dcoumented
Submitted: 2002-08-27 22:49 UTC Modified: 2002-08-28 13:55 UTC
From: undreamdev at hotmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.2 OS: linux 2.4.19 - RedHat
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: undreamdev at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-08-27 22:49 UTC] undreamdev at hotmail dot com
The docs say that _set_error_reporting can accept an array of object 
reference/method.  I believe this is incorrect. This function (in 4.2.2 at least) 
does not accept this.  
 
Stephen 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-27 22:54 UTC] sniper@php.net
I guess you meant set_error_handler(). Can you please provide a short example script that doesn't work as documented?

 [2002-08-28 00:05 UTC] undreamdev at hotmail dot com
here is my code. I have tried every combination of &$err/error_handler I 
could think off and none seem to work.    
 
------------------------code--------------- 
<?php 
 
$err = new Error(); 
//this should work but doesn't 
$old_eh = set_error_handler(array(&$err, 'errorHandler')); 
 
//this one works 
//$old_eh = set_error_handler('errorHandler')); 
 
// trigger my error. 
trigger_error('This is a booboo!', E_USER_ERROR); 
 
 
//begin error class 
Class Error 
{ 
 
	function errorHandler($errno, $errstr, $errfile, $errline) { 
 
		switch ($errno) { 
		case FATAL: 
			echo "<b>FATAL</b> [$errno] $errstr<br>\n"; 
			break; 
		case ERROR: 
			echo "<b>ERROR</b> [$errno] $errstr<br>\n"; 
			break; 
		case WARNING: 
			echo "<b>WARNING</b> [$errno] $errstr<br>\n"; 
			break; 
			default: 
			echo "Unkown error type: [$errno] $errstr<br>\n"; 
			break; 
		} 
	} 
 
} // end class 
 
 
//same as above without being in a class 
function errorHandler($errno, $errstr, $errfile, $errline) { 
 
		switch ($errno) { 
		case FATAL: 
			echo "<b>FATAL</b> [$errno] $errstr<br>\n"; 
			break; 
		case ERROR: 
			echo "<b>ERROR</b> [$errno] $errstr<br>\n"; 
			break; 
		case WARNING: 
			echo "<b>WARNING</b> [$errno] $errstr<br>\n"; 
			break; 
			default: 
			echo "Unkown error type: [$errno] $errstr<br>\n"; 
			break; 
		} 
	} 
?> 
------------------end code--------------
 [2002-08-28 13:55 UTC] sander@php.net
I actually updated the docs... there was a bugreport about it but since it worked fine here (4.3.0-dev), I updated the docs. Please try a snapshot from http://snaps.php.net and reopen if the problem persists.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 14:00:01 2026 UTC