#19033 [Com]: set_error_handler() to accepts object/method tuple
| From: | gandalf at alladyn dot art dot pl | Date: | Thu, 10 Oct 2002 15:34:37 +0000 |
| Subject: | #19033 [Com]: set_error_handler() to accepts object/method tuple | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22066@lists.php.net to get a copy of this message | ||
ID: 19033
Comment by: gandalf@alladyn.art.pl
Reported By: cyberwombat@yifan.net
Status: Closed
Bug Type: Program Execution
Operating System: linux 2.4.18
PHP Version: 4.2.1
New Comment:
<?
class Test{
function ErrorHandler($a,$b){
print("Error Handled");
}
}
$error=new Test();
print("AA".$fafa);
set_error_handler(array($error, 'ErrorHandler'));
print("AA".$fafa);
?>
Result:
------------------------------------
Notice: Undefined variable: fafa in
E:\server\www\sports\futur\test.phtml on line 8
AA
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
AA
------------------------------------
Sp - still doesnt work
Previous Comments:
------------------------------------------------------------------------
[2002-10-10 10:31:33] mfischer@php.net
He's simply using the wrong syntax.
The syntax is either
array($obj, 'method');
or
array('class', 'method');
so this makes
set_error_handler(array($obj, 'method'));
------------------------------------------------------------------------
[2002-10-10 10:29:45] cynic@php.net
i have not tested it, but presumably the interface is the same as for
call_user_func()
------------------------------------------------------------------------
[2002-10-10 10:00:24] gandalf@alladyn.art.pl
I downloaded this: http://snaps.php.net/win32/php4-win32-latest.zip
And it still doesnt work.
<?
class Test{
function ErrorHandler($a,$b){
print("Error Handled");
}
}
$error=new Test();
print("AA".$fafa);
set_error_handler('$error->ErrorHandler');
print("AA".$fafa);
?>
This bug should be probably reopened
------------------------------------------------------------------------
[2002-10-10 05:50:03] mfischer@php.net
In CVS, development snapshot is available at
http://snaps.php.net/php4-latest.tar.bz2
From the ChangeLog:
2002-06-12 Andrei Zmievski <andrei@php.net>
* NEWS:
set_error_handler() should take methods as callbacks. Also fixed it
to report
invalid callbacks.
------------------------------------------------------------------------
[2002-10-10 04:20:42] gandalf@alladyn.art.pl
I downloaded Yesterdays "laststable" version, and bug is still in. When
it was fixed?
------------------------------------------------------------------------
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/19033
--
Edit this bug report at http://bugs.php.net/?id=19033&edit=1