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

From: Date: Wed, 17 Oct 2001 16:07:24 +0000
Subject: Re: Bug #13616 Updated: Compiler complains about function declaration after return is called
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-68143@lists.php.net to get a copy of this message
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. Does it look past an exit? We at dealnews will have to stop at 4.0.6 for the foreseeable future if this stays like this in the 4.1.0 tree. Is there any chance of having this kept as acceptable code? Brian Moon ---------------------------------------------------------------------- dealnews.com, Inc. Makers of dealnews, dealmac http://dealnews.com/ | http://dealmac.com/ ----- Original Message ----- From: "Bug Database" <php-dev@lists.php.net> To: <brianm@dealnews.com> Sent: Wednesday, October 17, 2001 10:53 AM Subject: Bug #13616 Updated: Compiler complains about function declaration after return is called > ID: 13616 > Updated by: ssb > Reported By: brianm@dealnews.com > Old Status: Critical > Status: Suspended > Bug Type: Scripting Engine problem > Operating System: Linux > PHP Version: 4.0CVS-2001-10-09 > Old Assigned To: > Assigned To: ssb > New Comment: > > This turns out to be due to another bug fix (9884), and will probably > end up being documented as a compatibility breaker in 4.1.0. > I recommend that you use include_once instead. > > > Previous Comments: > ------------------------------------------------------------------------ > > [2001-10-11 20:20:06] ssb@php.net > > Example can be reduced to: > > test.php: > <?php > function foo() {} > include "test2.php"; > ?> > > test2.php: > <?php > return; > function foo() {} > ?> > > > ------------------------------------------------------------------------ > > [2001-10-10 14:40:32] sander@php.net > > Reproduced with latest dev from php4win.com (04-Oct-2001). > > ------------------------------------------------------------------------ > > [2001-10-10 02:31:17] derick@php.net > > Marking as fix before release > > ------------------------------------------------------------------------ > > [2001-10-09 13:57:28] sander@php.net > > Reclassified. > > ------------------------------------------------------------------------ > > [2001-10-09 13:09:15] brianm@dealnews.com > > We have been using code like this for a long time: > > test.php: > <?php > include "test2.php"; > include "test3.php"; > > foo(); > bar(); > ?> > > test2.php: > <?php > if(defined("_TEST2")) return; > define("_TEST2", true); > > function foo(){ > echo "foo\n"; > } > ?> > > test3.php > <?php > if(defined("_TEST3")) return; > define("_TEST3", true); > > include "test2.php"; > function bar(){ > echo "bar\n"; > } > ?> > > > With 4.0.6 we get: > ------------------- > $ php test.php > X-Powered-By: PHP/4.0.6RC4 > Content-type: text/html > > foo > bar > > With current dev we get: > ------------------------ > $ ./php test.php > X-Powered-By: PHP/4.0.8-dev > Content-type: text/html > > Fatal error: Cannot redeclare foo() (previously declared in /home/brianm/test2.php:6) in /home/brianm/test2.php on line 7 > > > ------------------------------------------------------------------------ > > > > ATTENTION! Do NOT reply to this email! > To reply, use the web interface found at http://bugs.php.net/?id=13616&edit=2 > > >

« previous php.dev (#68143) next »