|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 Joshua PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 21:00:02 2025 UTC |
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'));<? 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 workworks 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 <? error_reporting(E_ALL); class Test { function ErrorHandler($a,$b) { print("Error Handled\n"); } } $error=new Test(); print("AA".$fafa); set_error_handler(array($error, 'ErrorHandler')); print("AA".$fafa); roman@freepuppy ~ 1009:0 >