#25128 [Opn->Bgs]: set_error_handler not sending reference

From: Date: Mon, 18 Aug 2003 14:37:22 +0000
Subject: #25128 [Opn->Bgs]: set_error_handler not sending reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-46102@lists.php.net to get a copy of this message
ID: 25128 Updated by: sniper@php.net Reported By: auroraeosrose at hotmail dot com -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: Win XP Pro SP1 PHP Version: 4CVS-2003-08-18 (stable) New Comment: If you use the trigger_error() twice, it'll push the messages into the array just fine. Not bug. Previous Comments: ------------------------------------------------------------------------ [2003-08-18 09:22:26] auroraeosrose at hotmail dot com 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 this bug report at http://bugs.php.net/?id=25128&edit=1

« previous php.bugs (#46102) next »