Re: E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0

From: Date: Thu, 04 Jan 2007 10:54:58 +0000
Subject: Re: E_RECOVERABLE_ERROR - 5.1.6 to 5.2.0
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-246510@lists.php.net to get a copy of this message
# greg@chiaraquartet.net / 2007-01-03 15:18:59 -0600: > Roman Neuhauser wrote: > > # jochem@iamjochem.com / 2007-01-02 21:23:02 +0100: > >> David CHANIAL wrote: > >>> We are preparing the upgrade of PHP for our customers, but, after some tests, > >>> we have a migration "problem" caused by the news E_RECOVERABLE_ERROR. > >>> > >>> So, even if the upgrade guide (http://www.php.net/UPDATE_5_2.txt) talk about > >>> the method to handle this new errors (by using try/catch), they don't talk > >> there is no mention of try/catch - it seems that the rather unfortunate word > >> 'catchable' was used to describe the act of setting up a user defined error > >> handler > >> (see: > >> http://php.net/manual/en/function.set-error-handler.php) to handle > >> errors > >> that are triggered by the php core. [errors != exceptions] > > > > Unfortunately. Consider this: > > > > function f($any) > > { > > printf("%s\n", $any); > > } > > > > Innocent enough? It's an E_RECOVERABLE_ERROR if $any is an object > > without __toString(). > > It's also an example of a former C coder's understanding of how to do > things in PHP. Not only is this extremely inefficient (a function call > is significant overhead in PHP) it is doubly inefficient through the > unnecessary use of printf(). printf() is best used when you are > modifying the display of the output, the %s modifier by itself is > pointless in PHP. This is utter crap. > function f($any) > { > echo $any . "\n"; > } > > This has no E_RECOVERABLE_ERROR possibility and is far more efficient. > Better yet, replace > > f($blah) > > with > > echo $blah . "\n" echo $blah . "\n" is *not* equivalent to printf("%s\n", $blah) <more crap elided> -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991

« previous php.general (#246510) next »