Re: Re: Bug #13616 Updated: Compiler complains about function declaration after return is called

From: Date: Thu, 18 Oct 2001 10:55:12 +0000
Subject: Re: Re: Bug #13616 Updated: Compiler complains about function declaration after return is called
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-68214@lists.php.net to get a copy of this message
Hi jeroen! On Wed, 17 Oct 2001, jeroen@php.net wrote: > > "Brian Moon" <brianm@dealnews.com> wrote in message > news:00c601c15725$d00cf0c0$70fcf818@toney1.al.home.com... > > This is a huge compatibility breaker. The sad part is that you did not > > properly fix the bug in 9884. The bug is that the compiler looks past a > > return when compiling. > > That is not the bug, all languages do that. PHP4 has always parsed the whole > script, and will probably remain doing so. > > The issue here is that a functiondefinition isn't put in the function table > until the function definition is executed. > > This allows conditional function declaration. > > Zeev's bugfix fixed bug 9884 by changing semantics of return, by making > 'return'-ing from a script simply not possible anymore. > > > Does it look past an exit? > > It looks past everything, but _return_ in the body of a script is ignored, > but exit isn't. Using exit, nothing changed. Only return changed. > so if i want to do function f() { return include_once('big_function_body.php'); } [big_function_body.php] // stuff return $object; it won't work? I was considering doing that for some classes that have pretty big methods, but do I understand correctly that due to this change it cannot be used anymore? -- teodor

« previous php.dev (#68214) next »