Re: Unexpected Notice message
| From: | Andrew Ballard | Date: | Thu, 05 Jul 2012 13:24:39 +0000 |
| Subject: | Re: Unexpected Notice message | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-318403@lists.php.net to get a copy of this message | ||
On Thu, Jul 5, 2012 at 3:10 AM, Arno Kuhl <arno@dotcontent.net> wrote:
> -----Original Message-----
> From: Tim Streater [mailto:tim@clothears.org.uk]
> Sent: 04 July 2012 06:56 PM
> To: Marc Guay; php-general@lists.php.net
> Subject: Re: [PHP] Unexpected Notice message
>
> On 04 Jul 2012 at 16:51, Marc Guay <marc.guay@gmail.com> wrote:
>
>>> Notice: Use of undefined constant QUERY_STRING - assumed 'QUERY_STRING' in
>>
>> I would guess that it's asking you to add quotes around QUERY_STRING...?
>
> As in:
> if (strlen($_SERVER['QUERY_STRING']) > 0) {
>
>
> Cheers -- Tim
> ----
>
> Excellent, a bit surprised but that was it, thanks a lot.
>
> Cheers
> Arno
Why does this surprise you? $_SERVER is an array with string indices,
one of which happens to be the string 'QUERY_STRING'. However, your
code is trying to reference a constant named QUERY_STRING that does
not exist. The code will work because PHP will assume you meant to use
a string instead of a constant, but this will also generate a notice
to let you know that the code should be fixed.
Andrew