Michael wrote:
> On Wed, 16 Sep 2009 13:02:38 Nathan Kennedy wrote:
>> Then you might want to try something like:
>>
>> $value = array_key_exists('retry',$_GET)?$_GET['retry']:null;
>>
>> Which will not return that notice.
>
> The question is WTH were they thinking?
>
> PHP 5.3.0 seems to break quite a few things, and certainly what's wrong with
> referring to variables as $_GET["variable"] ?
>
> That's what all the books and online guides teach.
This isn't a 5.3.0 issue, if you've had notices turned on you'll get
this warning at least as far back as 4.3.x.
>What is the point of this? Is is a guard against XSS?
It's not specific to $_POST/_GET, it's a general array access thing - if
you try and use any array element that isn't defined, then PHP will
generate a notice to let you know about that. It's just that POST/GET
are the most common arrays people work with.
Part of the problem is that
if($_GET['whatever']) { ...
counts as accessing the element, so it'll spit a notice out - you have
to explicitly use isset (a language construct) or array_key_exists
(avoiding accessing the element) to avoid the notice.
--
E|2 DIGITAL
TIM OLIVER
SOFTWARE ENGINEER
P +64 3 377 0007
F +64 3 377 6582
E [email protected]
www.e2digital.co.nz
--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---