From:             davojan at mail dot ru
Operating system: FreeBSD 4.7-RELEASE
PHP version:      5.0.0b4 (beta4)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Includes from __autoload() doesn't register global variables.

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 bug report at http://bugs.php.net/?id=27333&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27333&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27333&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27333&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27333&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27333&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27333&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27333&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27333&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27333&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27333&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27333&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27333&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27333&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27333&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27333&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27333&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27333&r=float

Reply via email to