#22894 [Com]: set_error_handler fails to pick up method reference

From: Date: Wed, 20 Aug 2003 14:08:47 +0000
Subject: #22894 [Com]: set_error_handler fails to pick up method reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-46315@lists.php.net to get a copy of this message
 ID:               22894
 Comment by:       patr0ck at hispeed dot ch
 Reported By:      david dot grant at wiredmedia dot co dot uk
 Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows 2000
 PHP Version:      4.3.1
 New Comment:

oh, sorry it's wrong:

function JacketError($debug=false) {
			$this->class_version = "0.1";
// redefine user error constants
			define ("ERROR",	E_USER_ERROR);
			define ("WARNING",	E_USER_WARNING);
			define ("NOTICE",	E_USER_NOTICE);

			// set error reporting
			error_reporting(E_ALL);

			// set error handler
			if(!$debug)
				$this->old_error_handler = set_error_handler(array(&$this,
"handlerProductive"));
			else
				$this->old_error_handler = set_error_handler(array(&$this,
"handlerDebug"));



that's the constructor... copy paste is difficult ;)


Previous Comments:
------------------------------------------------------------------------

[2003-08-20 08:55:38] patr0ck at hispeed dot ch

i've got the same problem, but it's not depending on the number of
lines. sometimes the handler does work, sometimes it doesn't. Page
refreshing does switch between the original and my handler, but not
every time, most time it takes the original handler...

Setup: 
- PHP4.3.RC4 / PHP 4.3.1
- Win 2k (shame on my workstation)
- Apache 2.0.45 / Apache 1.3.28

--------------------------

Constructor:
function handlerDebug($errno, $errmsg, $errfile, $errline, $context) {
			$this->addError($errno, $errmsg, $errfile, $errline);
// redefine user error constants
			define ("ERROR",	E_USER_ERROR);
			define ("WARNING",	E_USER_WARNING);
			define ("NOTICE",	E_USER_NOTICE);

			// set error reporting
			error_reporting(E_ALL);

			// set error handler
			if(!$debug)
				$this->old_error_handler = set_error_handler(array(&$this,
"handlerProductive"));
			else
				$this->old_error_handler = set_error_handler(array(&$this,
"handlerDebug"));

--------------------------

Method:

function handlerDebug($errno, $errmsg, $errfile, $errline, $context) {
			$this->addError($errno, $errmsg, $errfile, $errline);
			switch($errno)
			{
				case ERROR:
					echo "<b><font style=\"background-color:black\"
color=\"gold\">Error:</font></b> $errmsg<br>\n";
					echo "&nbsp;&nbsp;&nbsp;<font
color=\"gray\">Line:</font> $errline
\n";
					echo "&nbsp;&nbsp;&nbsp;<font
color=\"gray\">File:</font>
$errfile<hr>\n";
					exit(1);
					break;
				
				case WARNING:
... and so on

-----------------------

software modifications doesn't help...

btw: i hope it works on linux ;o)

------------------------------------------------------------------------

[2003-04-09 16:45:04] sniper@php.net

Can not reproduce -> bogus.


------------------------------------------------------------------------

[2003-04-09 09:32:28] david dot grant at wiredmedia dot co dot uk

I have installed 4.3.2RC as directed, but the problem remains   .

------------------------------------------------------------------------

[2003-04-09 06:54:36] sniper@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip



------------------------------------------------------------------------

[2003-04-09 06:54:14] sniper@php.net

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.




------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/22894

-- 
Edit this bug report at http://bugs.php.net/?id=22894&edit=1



Thread (9 messages)

« previous php.bugs (#46315) next »