note 78699 added to function.set-error-handler
| From: | jean-pascal at online dot de | Date: | Wed, 24 Oct 2007 02:26:32 +0000 |
| Subject: | note 78699 added to function.set-error-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131678@lists.php.net to get a copy of this message | ||
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...
----
Server IP: 69.147.83.197
Probable Submitter: 84.175.193.120
----
Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php
Edit -- https://master.php.net/note/edit/78699
Del: integrated -- https://master.php.net/note/delete/78699/integrated
Del: useless -- https://master.php.net/note/delete/78699/useless
Del: bad code -- https://master.php.net/note/delete/78699/bad+code
Del: spam -- https://master.php.net/note/delete/78699/spam
Del: non-english -- https://master.php.net/note/delete/78699/non-english
Del: in docs -- https://master.php.net/note/delete/78699/in+docs
Del: other reasons-- https://master.php.net/note/delete/78699
Reject -- https://master.php.net/note/reject/78699
Search -- https://master.php.net/manage/user-notes.php