#13568 [Opn]: PHP3 semantics have been retained for nested functions

From: Date: Mon, 09 Sep 2002 13:14:10 +0000
Subject: #13568 [Opn]: PHP3 semantics have been retained for nested functions
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-18780@lists.php.net to get a copy of this message
ID: 13568 Updated by: hholzgra@php.net Reported By: alvarez@st-oneline.net Status: Open -Bug Type: Scripting Engine problem +Bug Type: Documentation problem -Operating System: Linux +Operating System: * PHP Version: 4.10 New Comment: the new semantics that allows calling functions prior to their definition only works for functions defined in a global scope as soon as a function definition is within a conditional block or nested within another function the new function cannot be created at parse time as it is not known yet wether the condition will be met or the surrounding function ever called, so these functions are created at runtime instead when execution reaches this part of the code so it is rather obvious that you can't call such a function ahead of it's definition well, maybe not *that* obvious, reclassified as documentation problem ... Previous Comments: ------------------------------------------------------------------------ [2001-12-14 14:01:10] yohgaki@php.net Parhaps, ZE2 should depreciate this syntax. I really want BNF for PHP. ------------------------------------------------------------------------ [2001-10-05 14:56:31] alvarez@st-oneline.net container (); a script to reproduce the error quickly. function container () { function nested_php3 () { echo "this will be output"; } nested_php3 (); nested_php4 (); function nested_php4 () { echo "this won't be output"; } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=13568&edit=1

« previous php.bugs (#18780) next »