Bug #17720: "Cannot redeclare function_name previously declared in ..." is bogus

From: Date: Wed, 12 Jun 2002 01:48:43 +0000
Subject: Bug #17720: "Cannot redeclare function_name previously declared in ..." is bogus
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10199@lists.php.net to get a copy of this message
From: bdgridly@mailbolt.com Operating system: Win2k and Apache PHP version: 4.2.1 PHP Bug Type: Compile Failure Bug description: "Cannot redeclare function_name previously declared in ..." is bogus It is possible in PHP 4.2.1 to confuse the interpreter into thinking a function had been previously declared when in fact it is the same function. I'm sure this used to work in PHP 4.01. I installed 4.2.1 today and now it complains. Sample test program: File: MAIN.PHP <?PHP include_once("test1.php"); function SystemTest() //<<-- Error: SystemTest() previously declared in Main.Php at line 4 { Test1(); } function NewTest() { echo "New Test"; } SystemTest(); ?> File: Test1.PHP <?PHP include_once("main.php"); function test1() { echo "This is Test1()<BR>"; NewTest(); } ?> If you run Main.PHP, it will generate an error because it thinks SystemTest was previously declared and it gives as the line number of the "other" definition as the line # where the error occurred. So it is really pointing to itself. In this simple example I could get rid of the "include_once("main.php")" and it will start to work. But what if Test1 is also called from test2.php. Then SystemTest() it won't find NewTest() that is in Main.Php. Can this be fixed? TIA Brent (e-mail me if you can with an explanation if it is operator error<g>) -- Edit bug report at http://bugs.php.net/?id=17720&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17720&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17720&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17720&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17720&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17720&r=support Expected behavior: http://bugs.php.net/fix.php?id=17720&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17720&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17720&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17720&r=globals

« previous php.bugs (#10199) next »