#34689 [Opn->Fbk]: Inconsistent handling of $GLOBALS from included files
| From: | sniper@php.net | Date: | Fri, 30 Sep 2005 10:28:11 +0000 |
| Subject: | #34689 [Opn->Fbk]: Inconsistent handling of $GLOBALS from included files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85802@lists.php.net to get a copy of this message | ||
ID: 34689
Updated by: sniper@php.net
Reported By: sebastian@php.net
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.1.0RC1
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-09-30 12:26:35] sebastian@php.net
Description:
------------
test.php
<?php
include_once 'foo.php';
var_dump($GLOBALS['foo']);
?>
foo.php
<?php
$foo = 'bar';
?>
Output
string(3) "bar"
test.php
<?php
class PHPUnit2_Util_Fileloader {
public static function checkAndLoad($filename) {
include_once $filename;
}
}
PHPUnit2_Util_Fileloader::checkAndLoad('foo.php');
var_dump($GLOBALS['foo']);
?>
foo.php
<?php
$foo = 'bar';
?>
Output
NULL
test.php
<?php
class PHPUnit2_Util_Fileloader {
public static function checkAndLoad($filename) {
include_once $filename;
}
}
PHPUnit2_Util_Fileloader::checkAndLoad('foo.php');
var_dump($GLOBALS['foo']);
?>
foo.php
<?php
$GLOBALS['foo'] = 'bar';
?>
Output
string(3) "bar"
Reproduce code:
---------------
test.php
<?php
class PHPUnit2_Util_Fileloader {
public static function checkAndLoad($filename) {
include_once $filename;
}
}
PHPUnit2_Util_Fileloader::checkAndLoad('foo.php');
var_dump($GLOBALS['foo']);
?>
foo.php
<?php
$foo = 'bar';
?>
Expected result:
----------------
string(3) "bar"
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34689&edit=1