note 78699 deleted from function.set-error-handler by felipe

From: Date: Sun, 16 Dec 2007 11:50:41 +0000
Subject: note 78699 deleted from function.set-error-handler by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133676@lists.php.net to get a copy of this message
Note Submitter: jean-pascal at online dot de ---- If you are going to use this method http://www.php.net/manual/de/function.set-error-handler.php#35622 inside of classes u maybe be happy to know following before having it: <? class MyClass { public function __construct() { ob_start( array( &$this, 'obHandler' ) ); unknownMethod(); // this will work outside_of_class(); // see below } private function obHandler( $buffer ) { if( @preg_match( '/^<b>([a-zA-Z]+ error|Warning)<\/b>: (.*) in <b>(.*)<\/b> on line <b>([0-9]+)<\/b><br \/>$/', trim( $lines[ $i ] ), $match ) ) { array_shift( $match ); return var_export( $match ); } return $buffer; } } function outside_of_class() { unknownMethod(); // this will not work (empty output) because obHandler is private } ?> Dunno if this is a bug, just took me 3 hours to get this...

« previous php.notes (#133676) next »