Bug #14295 Updated: Scope of globals has changed

From: Date: Sun, 02 Dec 2001 06:52:04 +0000
Subject: Bug #14295 Updated: Scope of globals has changed
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-72246@lists.php.net to get a copy of this message
ID: 14295 Updated by: zak Reported By: v.puttrich@digitalliquid.de Status: Open Bug Type: Variables related Operating System: Win2k PHP Version: 4.0.6 New Comment: Cannot reproduce under PHP 4.1.0 w/ Linux Please try the code below. Save the files under the names indicated in the comments and try running test.php: # test.php <?php include 'test.inc'; echo "Main File: $PHP_SELF" ?> # test.inc <?php echo "Included File: $PHP_SELF" ?> Previous Comments: ------------------------------------------------------------------------ [2001-11-30 15:07:54] v.puttrich@digitalliquid.de EXAMPLE: // Main script // The global variables are available in this script include("form.inc.php"); ... // End main script ---- // File: form.inc.php // The global variables from the main script are not available here <form action="<?php echo $PHP_SELF; ?>" method="post"> [form] </form> // End file: form.inc.php ------------------------------------------------------------------------ [2001-11-30 12:25:30] sniper@php.net Please include short example scripts here. ------------------------------------------------------------------------ [2001-11-30 03:51:40] v.puttrich@digitalliquid.de The following bug or feature (not yet sure what it is ;)) is related to the scope of global variables. SYSTEM: I use PHP 4.0.6 on Win2k pro as i downloaded it from this web site. The loading of extra modules does not change the described behaviour. The Server API is Apache (Apache V. 1.3.22 win) PHP.INI: register_globals and register_argc_argv is ON DESCRIPTION: I have the global variable $PHP_SELF. Now i include a file where I want to use $PHP_SELF. Within the included file, $PHP_SELF is unknown (it has lost it's global state), and i have to declare it global again. This appears for any other global variables too, $PHP_SELF is just an example- This behaviour seems to be new to PHP 4.0.6, because i didn't have the problem with 4.0.5. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14295&edit=1

« previous php.dev (#72246) next »