From:
Operating system: Linux x86_64
PHP version: 5.2.13
Package: Variables related
Bug Type: Bug
Bug description:definitions of global varaibles not working properly
Description:
------------
hi,
I would like to define few variables global so that I can use them in all
functions - also if I include a php file with functions.
actually I expect, that if I declare a variable outside the functions as
global, that those variables are available inside the functions.
Test script:
---------------
global $var1;
function funct1()
{
echo $var1;
}
include 'incl_file1';
incl_dile1:
function funct2()
{
echo $var1;
}
Expected result:
----------------
should work without problem or notice that var1 is not defined...
--
Edit bug report at http://bugs.php.net/bug.php?id=51840&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51840&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51840&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51840&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51840&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51840&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51840&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51840&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51840&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51840&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51840&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51840&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51840&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51840&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51840&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51840&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51840&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51840&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51840&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51840&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51840&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51840&r=mysqlcfg