#36952 [NEW]: Can't set an error handler to the private method

From: Date: Sun, 02 Apr 2006 16:21:57 +0000
Subject: #36952 [NEW]: Can't set an error handler to the private method
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95219@lists.php.net to get a copy of this message
From:             acc dot data at gmail dot com
Operating system: Windows 2003
PHP version:      5CVS-2006-04-02 (snap)
PHP Bug Type:     *General Issues
Bug description:  Can't set an error handler to the private method

Description:
------------
Can't set an error handler to a private method from another (public)
method of the same class

Reproduce code:
---------------
<?php

class Test
{
	private function errorHandler($errno, $errstr, $errfile, $errline)
	{
		echo "handled";
	}
	function __construct()
	{
		set_error_handler(array(&$this, "errorHandler"));
		$dom = new DOMDocument();
		$dom->load("not found"); // warning
		restore_error_handler();
	}
}

$test = new Test();

?>

Expected result:
----------------
handled

Actual result:
--------------
Fatal error: Call to private method Test::errorHandler() from context ''
in C:\test.php on line 13

-- 
Edit bug report at http://bugs.php.net/?id=36952&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36952&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36952&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36952&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36952&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=36952&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36952&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36952&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36952&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36952&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36952&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=36952&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=36952&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36952&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36952&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36952&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36952&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36952&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36952&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36952&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36952&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#95219) next »