|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19033 win32 snapshots broken / set_error_handler() to accepts object/method tuple
Submitted: 2002-08-22 03:23 UTC Modified: 2002-10-18 16:33 UTC
From: cyberwombat at yifan dot net Assigned:
Status: Closed Package: Program Execution
PHP Version: 4CVS-2002-10-12 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: cyberwombat at yifan dot net
New email:
PHP Version: OS:


 [2002-08-22 03:23 UTC] cyberwombat at yifan dot net
set_error_handler should accept a method/object pair for OO error 
handling.  Bug 9155 had the same thing. It said it was fixed (sometimes 
mid-2001) However it does not seem to work and the code does not 
appear to me to accept a  object/method pair 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-22 08:35 UTC]
Works fine for me. You have to supply an array containing an object reference and a method name. I've added a note about this to the manual.
 [2002-08-26 19:14 UTC] cyberwombat at yifan dot net
Please provide an example and PHP version you are using. I am on 4.2.1 
and have tried every conceivable combinations of object/method and none 
$error  = new ErrorHandler(); 
Ex:  $old=set_error_handler(array(&$error, "error_handler_method")); 
and vice versa only returns false. The method indicated has been tested 
outside of a class and works perfectly.
 [2002-10-09 13:22 UTC] gandalf at mozillapl dot org
I still recive this bug.
I'm unable to do this:

$old=set_error_handler(array($error, "ErrorHandler"));

(from outside the class)
or this:

$old=set_error_handler(array($this, "ErrorHandler"));
(from inside)

I'm using PHP 4.2.3 for Windows
 [2002-10-10 02:57 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

 [2002-10-10 04:20 UTC] gandalf at alladyn dot art dot pl
I downloaded Yesterdays "laststable" version, and bug is still in. When it was fixed?
 [2002-10-10 05:50 UTC]
In CVS, development snapshot is available at

From the ChangeLog:
2002-06-12  Andrei Zmievski  <>

    * NEWS:

    set_error_handler() should take methods as callbacks. Also fixed it to report
    invalid callbacks.
 [2002-10-10 10:00 UTC] gandalf at alladyn dot art dot pl
I downloaded this:

And it still doesnt work.
class Test{
	function ErrorHandler($a,$b){
		print("Error Handled");
$error=new Test();

This bug should be probably reopened
 [2002-10-10 10:29 UTC]
i have not tested it, but presumably the interface is the same as for call_user_func()

 [2002-10-10 10:31 UTC]
He's simply using the wrong syntax.

The syntax is either

  array($obj, 'method');


  array('class', 'method');

so this makes

set_error_handler(array($obj, 'method'));
 [2002-10-10 10:34 UTC] gandalf at alladyn dot art dot pl
class Test{
	function ErrorHandler($a,$b){
		print("Error Handled");
$error=new Test();
set_error_handler(array($error, 'ErrorHandler'));


Notice: Undefined variable: fafa in E:\server\www\sports\futur\test.phtml on line 8
Notice: Array to string conversion in E:\server\www\sports\futur\test.phtml on line 9

Notice: Undefined variable: fafa in E:\server\www\sports\futur\test.phtml on line 10

Sp - still doesnt work
 [2002-10-10 10:44 UTC]
works fine for me with a 2 days old HEAD. you're doing something wrong.

roman@freepuppy ~ 1005:0 > php -v
PHP 4.4.0-dev (cli), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.4.0, Copyright (c) 1998-2002 Zend Technologies
roman@freepuppy ~ 1006:1 > tmp/scratch2

Notice: Undefined variable:  fafa in /usr/home/roman/tmp/scratch2 on line 13
AAError Handled
roman@freepuppy ~ 1007:0 > uname -sr
FreeBSD 4.7-RC
roman@freepuppy ~ 1008:0 > < tmp/scratch2
#!/usr/bin/env php


    class Test
        function ErrorHandler($a,$b)
            print("Error Handled\n");
    $error=new Test();
    set_error_handler(array($error, 'ErrorHandler'));

roman@freepuppy ~ 1009:0 > 

 [2002-10-10 10:55 UTC]
linux works

Win32 snapshot from seems to be b0rked.

Can't check out CVS HEAD and test (besides that it's currently broken because of some recent changes).

Reopening and thanks for insisting it doesn't work ;-)
 [2002-10-10 11:00 UTC]
OS update.

 [2002-10-10 17:50 UTC]
Making this critical and assigned to edin.

 [2002-10-11 08:22 UTC]
Windows build was broken since Oct 7, so no new snapshots were generated. Now that has been fixed, so could you please try the latest snapshot?
 [2002-10-12 04:39 UTC] alladyn at alladyn dot art dot pl
Confirming. Newest Windows snapshot works OK.
Thanks for fixing this bug.
 [2002-10-12 04:43 UTC]
Closing then.
 [2002-10-12 08:53 UTC] gandalf at alladyn dot art dot pl
Sorry to say, but it has to be reopened once more.
This trunk works strange. Sometimes handler works, but in most situations it doesnt.
 I'm working with big part of code, and there i first time saw that sometimes handler doesnt work. Then i was trying to create tescase, and could not. Finaly i created test file, copied code from my comment and it's not working now.

Notice: Undefined variable: fafa in E:\server\www\sports\futur\test.phtml on line 8
Notice: Undefined variable: fafa in E:\server\www\sports\futur\test.phtml on line 10

After Apache restart it worked once or twice.
After few reloads bug appeard.

Try to reproduce. Just reload part of code few times.

PHP dev 4.3.0
Apache 2.43
Windows 2000
 [2002-10-12 09:44 UTC]
Reopening, status->critical.
 [2002-10-12 10:01 UTC]
Reopen only if you can confirm something..this is closed.
(most likely not using recent enough snapshot and has installed it wrong)

 [2002-10-12 10:40 UTC] gandalf at alladyn dot art dot pl
I installed version from 2 minutes ago.
Same thing. 
Sometimes it works, usually not. Few times it worked after apache restart, few times after changing list of function attributes...
 [2002-10-14 02:43 UTC]
Re-opening, not critical.

However to track this down we need some reproduceable script I think.

Updated Version.
 [2002-10-14 08:39 UTC] gandalf at alladyn dot art dot pl
Yes. Thats what makes this bug so hard to prove. I can only write about what i see. As i wrote, i see some unregular problem.

I can only write about my suspicions. It looks like, not every time handler "catches" relation. Alomst always, first time after apache2+php starts handler works, after second or third try it stops, and then after 20-30 reloads one or twice it works.

Only thing i can do is send You avi with captured this issue. Or, if PHP has any Profile collector, i could create log from PHP's work.
 [2002-10-14 17:28 UTC]
You should try using apache 1.3.27 which actually works.
Apache2 is way too unstable and not ready for any production use anyway. If this happens also with Apache 1.3.27, then
it's really something that needs to be looked into..

 [2002-10-16 09:15 UTC] gandalf at alladyn dot art dot pl
I chenged Apache to Apache 1.3.27.
Still this bug, but i found something which might be helpfull.
I'm using Mozilla browser ( Mozilla has two different methods for "reload" page. One is (well known from IE) ctrl+r, and second is ctrl+shift+r.
First, works like reload in IE, second is "hard" reload. No matter if anything changed, full page is reloaded.

When i'm using ctrl+r on a test.phtml i see handler not working, when i'm using ctrl+shift+r handler works.

Will it help You determinating what is happening?
 [2002-10-18 16:33 UTC]
Other people said this is fixed so I suspect you've just  
done that usual mistake and haven't installed PHP correctly. 
Mainly the file php4ts.dll comes to my mind..

If you can prove that there really is bug in _PHP_, then
please open a new bug report with proper information such
as short example script..

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 08 22:01:30 2023 UTC