Bug #15105 Updated: Declaring a function twice

From: Date: Fri, 18 Jan 2002 19:26:40 +0000
Subject: Bug #15105 Updated: Declaring a function twice
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-77466@lists.php.net to get a copy of this message
ID: 15105 Updated by: hholzgra Reported By: tapken@engter.de Old Status: Duplicate Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.1.1 New Comment: "should only be declared once" is true, and on the second try it gives an error as it *can* only be declared once instead of just silently ignoring it (there's no practical way for the parser to find out that it is *exactly* the same definition) hint: http://php.net/function_exists Previous Comments: ------------------------------------------------------------------------ [2002-01-18 14:26:19] sander@php.net It's a dupe... can't find the bug anymore, but it is a dupe. ------------------------------------------------------------------------ [2002-01-18 14:14:02] tapken@engter.de Don't know if this is a bug or a feature... -foo.php---------------------------------------- <?php if (!$bar) { $bar = true; include(__FILE__); exit; } function foo() { return true; } ?> -/foo.php---------------------------------------- This is a VERY simplified version of a script i'm working on. foo() should only be declared once but PHP says: <b>Fatal error</b>: Cannot redeclare foo() in <b>/home/roland/tmp/foo.php</b> on line <b>7</b><br> ok, i know how a can work around this problem... in this case just put the rest of the file into the else-statement. But nevertheless it is an interesting phenomen... ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=15105&edit=1

« previous php.dev (#77466) next »