PHP 5.4 specific ISSET request for $ _GET. $ _POST Superglobal

I need to upgrade my mission-critical (not all?) Ubuntu server from PHP 5.3 to 5.4, and I'm happy about everything but one possible issue. Our PHP scripts include about 1200 ISSET () references, almost all of which check the state of the $ _GET or $ _POST variables whose names contain strings rather than numbers.

I know the difference (5.3 v 5.4) where 5.4 returns false when ISSET ($ var ['somestringvalue']) is used and my request is whether this unwanted behavior will apply to our $ _POST string value and $ _GET variables ?

I'd put a quick 5.4 test server, but we use so many extensions and tweaks that it's even easier said than done. so I thought I'd try my luck first. Thanks in advance.

+3


source to share


1 answer


This is not "unwanted behavior", it is actually useful. The behavior only changes if isset () is called on a string.

$string = 'My string'; // length = 9, character indexes 0 to 8
var_dump(isset($string[5])); // makes sense -> checks whether there a character on the 5th position (true)
var_dump(isset($string[10])); // makes sense -> checks whether there a character on the 10th position (false)
var_dump(isset($string['foo'])); // doesn't make sense -> checks whether there a character on the "foo" position (false)

      



Since $ _GET and $ _POST are always associative arrays, this new behavior won't affect you in any way. For more information check out the operation manual http://php.net/manual/en/function.isset.php

PS: you should consider a development server to test this kind of thing without creating problems for your users and clients!

+1


source







All Articles