Edit report at http://bugs.php.net/bug.php?id=54945&edit=1

 ID:                 54945
 Updated by:         bj...@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

Reply via email to