Bug #54945 [Opn->Bgs]: Function declarations inside if/else statements don't work correctly
| From: | bjori@php.net | Date: | Sun, 29 May 2011 12:36:39 +0000 |
| Subject: | Bug #54945 [Opn->Bgs]: Function declarations inside if/else statements don't work correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161026@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54945&edit=1
ID: 54945
Updated by: bjori@php.net
Reported by: charlie at charliesomerville dot com
Summary: Function declarations inside if/else statements
don't work correctly
-Status: Open
+Status: Bogus
Type: Bug
Package: Scripting Engine problem
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Disable the zend extensions you are using and try again.
Previous Comments:
------------------------------------------------------------------------
[2011-05-28 12:38:37] charlie at charliesomerville dot com
Description:
------------
When declaring a function inside an if/else statement, the latter
declaration is
honoured regardless of which branch the if/else statement took.
Test script:
---------------
<?php
if(true)
{
function foo()
{
echo "first foo.";
}
}
else
{
function foo()
{
echo "second foo.";
}
}
foo();
Expected result:
----------------
first foo.
OR:
Syntax Error: Cannot declare function inside conditional statement
Actual result:
--------------
second foo.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54945&edit=1