ID: 15105
Updated by: hholzgra
Reported By: [EMAIL PROTECTED]
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] [EMAIL PROTECTED]

It's a dupe... can't find the bug anymore, but it is a dupe.

------------------------------------------------------------------------

[2002-01-18 14:14:02] [EMAIL PROTECTED]

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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to