Part of the EllisLab Network
   
 
[OPTIMIZATION] Input > _sanitize_globals
Posted: 06 May 2007 09:16 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  737
Joined  10-18-2006

Is there a point asking if $_GET, $_POST and $_COOKIE are arrays?

In http://www.php.net/manual/en/language.variables.predefined.php says those are “predefined arrays”, so I don’t think we need to check this…

Stupid benchmarking test…  checking 10.000 if $_POST is array took 0.0155 versus 0.0089 for doing nothing 10.000

 Signature 

Once in a while I remember I use Twitter

Profile
 
 
Posted: 06 May 2007 10:54 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
RankRank
Total Posts:  248
Joined  02-10-2007

They are predefined arrays indeed. It doesn’t hurt to check whether they are arrays though.  On the other hand, if the is_array() checks can be left out, why not?

I’m only wondering whether it would be possible for a user to overwrite those predefined arrays. I think that would be possible by using a pre_system hook or so. Maybe let’s just not touch the _sanitize_globals() function then.

 Signature 

Kohana rocks!

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120025 Total Logged-in Users: 38
Total Topics: 126159 Total Anonymous Users: 4
Total Replies: 663605 Total Guests: 359
Total Posts: 789764    
Members ( View Memberlist )