#27333 [Opn->Bgs]: Includes from __autoload() doesn't register global variables.
| From: | helly@php.net | Date: | Fri, 20 Feb 2004 17:28:46 +0000 |
| Subject: | #27333 [Opn->Bgs]: Includes from __autoload() doesn't register global variables. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-55245@lists.php.net to get a copy of this message | ||
ID: 27333
Updated by: helly@php.net
Reported By: davojan at mail dot ru
-Status: Open
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: FreeBSD 4.7-RELEASE
PHP Version: 5.0.0b4 (beta4)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Your so called global variable is obviously local to the calling
function (__autoload).
Previous Comments:
------------------------------------------------------------------------
[2004-02-20 11:48:34] davojan at mail dot ru
Description:
------------
If script links from __autoload(), global variables, defined in it, are
not visible in the calling environment.
In the simple example below I executed 'autoload.php'.
Reproduce code:
---------------
file 'foo.php':
<?
$GLOBAL_VAR = 'GLOBAL_VAR';
class foo {}
?>
file 'autoload.php':
<?
function __autoload ($name)
{
require_once 'foo.php';
}
$foo = new foo();
echo $GLOBAL_VAR;
?>
Expected result:
----------------
GLOBAL_VAR
Actual result:
--------------
Notice: Undefined variable: GLOBAL_VAR in
/usr/local/www/data-dist/ils/admin/test/autoload.php on line 7
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27333&edit=1