# [EMAIL PROTECTED] / 2007-01-03 15:18:59 -0600:
> Roman Neuhauser wrote:
> > # [EMAIL PROTECTED] / 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to