php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11196 'Cannot redeclare' in nested functions
Submitted: 2001-05-30 11:19 UTC Modified: 2001-06-01 08:03 UTC
From: flying at dom dot natm dot ru Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.5 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: flying at dom dot natm dot ru
New email:
PHP Version: OS:

 

 [2001-05-30 11:19 UTC] flying at dom dot natm dot ru
Environment:
 - Windows 2000 Server
 - Apache v1.3.19
 - PHP v4.0.5 (Win32 binaries from www.php.net)

Following script falls with error message:
Fatal error: Cannot redeclare innerfunc() in test.php line 4

-----------------------------------------------
<?php
function outerFunc()
{
    function innerFunc()
    {
        echo "Into innerFunc()<br>";
    }
    echo "Entering outerFunc()<br>";
    innerFunc();
    echo "Leaving outerFunc()<br>";
};

outerFunc();
outerFunc();
?>
-----------------------------------------------

Crash appears at second function call. 

Bug is 100% reproducible in PHP v4.0.4 and v4.0.5

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-30 11:42 UTC] sniper@php.net
not a bug. You can't redeclare functions.
(you're calling outerFunc() twice)

--Jani

 [2001-06-01 08:03 UTC] flying at dom dot natm dot ru
So, it means that you have a bug in documentation in this case.
 Here is a small piece of text from functions.html:

-----------------------
Any valid PHP code may appear inside a function, even <b>other functions</b> and class definitions.
-----------------------

 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 07:01:32 2024 UTC