php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22894 set_error_handler fails to pick up method reference
Submitted: 2003-03-26 05:50 UTC Modified: 2003-04-09 16:45 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: david dot grant at wiredmedia dot co dot uk Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.1 OS: Windows 2000
Private report: No CVE-ID: None
 [2003-03-26 05:50 UTC] david dot grant at wiredmedia dot co dot uk
I have attempted to assign a class method to "set_error_handler" using the array approach recommended in the manual.  However, a testing error is not picked up, and output to the HTTP response instead.

I have tried passing the object as a reference internally (e.g. &$this) and externally with the variable name of the instance.

PHP 4.3.1
IIS 5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-09 05:59 UTC] sniper@php.net
You're doing something wrong. Not bug in PHP.

 [2003-04-09 06:50 UTC] david dot grant at wiredmedia dot co dot uk
I've just retested this bug with the same setup (4.3.1, IIS 5), and got some strange results.

In the constructor, I have a single instruction:

set_error_handler(array(&$this, 'ReportError'));

Then, in the ReportError() method, I have the following:

echo ("ERROR CAUGHT");

In order to test the error handler, I instantiate the object in a seperate script, and attempt to increment variable i , which doesn't exist.  This *should* be handled by the error handling class, but is not.  It is instead handled by the built-in PHP error handler.

Now for the strange part.

I added a HTML comment (echo("<!-- X -->")) to both the constructor and the ReportError method, and PHP started to use my error reporting class to report the error.

With further investigation, the reporting seems to change depending on the number of lines in the file.
 [2003-04-09 06:54 UTC] 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.



 [2003-04-09 09:32 UTC] david dot grant at wiredmedia dot co dot uk
I have installed 4.3.2RC as directed, but the problem remains   .
 [2003-04-09 16:45 UTC] sniper@php.net
Can not reproduce -> bogus.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 22:01:26 2024 UTC