From: yippaolo at yahoo dot com Operating system: windows xp SP3 PHP version: 5.2.10 PHP Bug Type: Variables related Bug description: Global variable is valid in the beginning of .php, which is invalid at the end.
Description: ------------ Apache version:2.0.63; PHP version 5.2.10 (.zip); IE 6.0 SP3 I defined a global variable in the beginning of the .php file. It is valid at the beginning of the file, while it becomes invalid at the end of the file. There is no function defined in this .php file. For the details pls see reproduce code. Reproduce code: --------------- All the places this variable is defined or refered are as follows. line 20: $isloc=$_GET["l"];//Define. It works! line 31: switch($isloc){...} line 37: if($isloc!="") {... line 109: for($a=1;$a<=$pages;$a++) line 110: {//for line 111: if($a!=$gpage)$cmmt1.='<a href=***.php?l='.$isloc.'&id='...'</a> ';////It works! line 112: else ... line 113: }//for }//if line 114: if($isloc!="")echo $isloc;///It becomes null! line 115: else echo '$isloc is null'; Expected result: ---------------- shows the value of $isloc Actual result: -------------- '$isloc is null' -- Edit bug report at http://bugs.php.net/?id=49319&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49319&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49319&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49319&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49319&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49319&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49319&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49319&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49319&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49319&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49319&r=support Expected behavior: http://bugs.php.net/fix.php?id=49319&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49319&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49319&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49319&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49319&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49319&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49319&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49319&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49319&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49319&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49319&r=mysqlcfg