PHP 4.0 Bug #9064 Updated: Functions inside functions cause errors if the outer function is called twice.

From: Date: Fri, 02 Feb 2001 09:14:00 +0000
Subject: PHP 4.0 Bug #9064 Updated: Functions inside functions cause errors if the outer function is called twice.
Groups: php.dev 
Request: Send a blank email to php-dev+get-45593@lists.php.net to get a copy of this message
ID: 9064 Updated by: hholzgra Reported By: chriskl@familyhealth.com.au Old-Status: Open Status: Closed Bug Type: Scripting Engine problem Assigned To: Comments: php has no "nested function" feature like you'll find in PASCAL or in gcc if you enable the feature what happens here is that test2 is registered on execution of test in the global namespace, and when you call test a second time it cannot register test2 again (the engine shouldn't accept nested functions at all i think) Previous Comments: --------------------------------------------------------------------------- [2001-02-01 22:18:32] chriskl@familyhealth.com.au This script fails with: <b>Fatal error</b>: Cannot redeclare test2() in <b>-</b> on line <b>4</b><br> <?php function test() { function test2() { echo "hi"; } test2(); } test(); test(); test(); ?> --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=9064

« previous php.dev (#45593) next »