phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-developers] php 4.2+


From: Dave Hall
Subject: [Phpgroupware-developers] php 4.2+
Date: Wed, 26 Jun 2002 15:27:00 +1000

Hi all,

I have installed php 4.2.1 and hit a few problems. There has been a 
change in php 4.2.0, which will affect all php developers. Here is the 
snippet from the manual.

<quote 
source="http://www.php.net/manual/en/language.variables.predefined.php";>
In PHP 4.2.0 and later, the default set of predefined variables which  
are available in the global scope has changed. Individual input and  
server variables are by default no longer placed directly into the  
global scope; rather, they are placed into the following superglobal  
arrays. 

You can still force the old behaviour by setting register_globals to  
'On' in your php.ini file. 

For more information and background on this change, please see the PHP  
4.1.0 Release Announcement. 
</quote>

There is a stack of new super globals $_* introduced in 4.1.0, but for  
backward compatibility there is still the older $HTTP_*_VARS arrays,  
which aren't available in functions or classes but are available in the 
straight script.

I understand the logic behind the change and think it is good. Although 
this will take some time be set on all systems, many newbies are likely 
to have register_globals=off. This  will mean scripts will break. The 
way to fix it is to change the the script so there is 
$var=$HTTP_???_VARS['var'] somewhere near the top. 

On irc the other day lex suggested that there be a phpgwapi function 
called something like find_var($name,$type) which returns the  
variable?? (sorry lex if i misunderstood). From memory Milosch suggested 
this will happen. This won't be until atleast .16 which leaves us with 
the issue of what do we do now?

I have three possible solutions. We start hacking away with adding  
$HTTP_POST_VARS and $HTTP_GET_VARS in the top of all scripts.  The 
header prints a warning to all users who have register globals off.  The 
new find_var function be developed and dropped in.

Cheers

skwashd
Dave Hall

PS - I appologize in advance if I have missed something somewhere and 
have caused unnessary panic.  If I am wrong please go easy on me.

Attachment: dave.hall.vcf
Description: Card for <dave.hall@mbox.com.au>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]