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

From: Date: Sun, 02 Apr 2006 17:11:49 +0000
Subject: #36952 [Bgs]: Can't set an error handler to the private method
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95221@lists.php.net to get a copy of this message
 ID:               36952
 User updated by:  acc dot data at gmail dot com
 Reported By:      acc dot data at gmail dot com
 Status:           Bogus
 Bug Type:         *General Issues
 Operating System: Windows 2003
 PHP Version:      5CVS-2006-04-02 (snap)
 New Comment:

Thank you


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

[2006-04-02 18:35:57] mike@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The error handler is called from outside of this class, so it must be
public.


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

[2006-04-02 18:21:57] acc dot data at gmail dot com

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 this bug report at http://bugs.php.net/?id=36952&edit=1


Thread (3 messages)

« previous php.bugs (#95221) next »