#25128 [NEW]: set_error_handler not sending reference

From: Date: Mon, 18 Aug 2003 14:22:26 +0000
Subject: #25128 [NEW]: set_error_handler not sending reference
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-46098@lists.php.net to get a copy of this message
From: auroraeosrose at hotmail dot com Operating system: Win XP Pro SP1 PHP version: 4CVS-2003-08-18 (stable) PHP Bug Type: *General Issues Bug description: set_error_handler not sending reference Description: ------------ Latest cvs snapshot of 4.3.whatever we're at now. When sending an object/method array for a set_error_handler, the object is not being referenced, I have no idea what it's doing. I'd like to be able to change stuff in the object I have the error handler in before an error is triggered... This may be a dupe of #22894 but I'm not sure since that one wasn't explained very well... Reproduce code: --------------- <? class Stack { var $stack; function Stack() { $this->stack = array(); set_error_handler(array(&$this, 'errorHandler')); } function push($message) { $this->stack[] = $message; print_r($this); //for debugging } function errorHandler($code, $message, $file, $line, $context) { $this->push($message); } } $e = new Stack(); $e->push('This is a fun test'); trigger_error('This is a test', E_USER_NOTICE); ?> Expected result: ---------------- stack Object ( [stack] => Array ( [0] => This is a fun test ) ) stack Object ( [stack] => Array ( [0] => This is fun a test [1] => This is a test ) ) Actual result: -------------- stack Object ( [stack] => Array ( [0] => This is a fun test ) ) stack Object ( [stack] => Array ( [0] => This is a test ) ) -- Edit bug report at http://bugs.php.net/?id=25128&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25128&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25128&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25128&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25128&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25128&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25128&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25128&r=support Expected behavior: http://bugs.php.net/fix.php?id=25128&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25128&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25128&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25128&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25128&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25128&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25128&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25128&r=gnused

« previous php.bugs (#46098) next »