ID:               49319
 User updated by:  yippaolo at yahoo dot com
 Reported By:      yippaolo at yahoo dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Variables related
 Operating System: windows xp SP3
 PHP Version:      5.2.10
 New Comment:

I just tried the test case. The variable works all the time. Still
don't know the reason for failure in the big file mentioned before.

$isloc='1';
switch($isloc){ case '1':;}
$pages=4;
if($isloc!="")
{
        for($a=1;$a<=$pages;$a++)
        {//for
        if($a!=$page)$cmmt1.='<a
        href=ad.php?l='.$isloc.'&id=</a>&nbsp;';
        else {}         
        }//for  
}//if  
if($isloc!=""){echo $isloc;}
else {echo '$isloc is null';}


Previous Comments:
------------------------------------------------------------------------

[2009-08-21 10:01:42] paj...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2009-08-21 09:59:31] yippaolo at yahoo dot com

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>&nbsp;';////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 this bug report at http://bugs.php.net/?id=49319&edit=1

Reply via email to