Re: suppressing errors with "@"
| From: | Miguel Cruz | Date: | Sat, 06 Jul 2002 02:50:54 +0000 |
| Subject: | Re: suppressing errors with "@" | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-105787@lists.php.net to get a copy of this message | ||
On Sat, 6 Jul 2002, Uri Even-Chen wrote:
> I tried to suppress warnings in isset expressions (Uninitialized string
> offset warnings). The original line was something like this:
>
> if (!(isset($GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME'])))
>
> When I added the "@" sign like this:
>
> if (!(isset(@$GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME'])))
>
> My program stopped working, and I got errors like:
>
> PHP Parse error: parse error, expecting
T_VARIABLE' or
> '$'' ....
>
> Eventually, I put the "@" in this place:
>
> if (!(@isset($GLOBALS['SPEEDY_GLOBAL_VARS']['PAGE_NAME'])))
>
> Which works, but why didn't it work the other way? Is it some kind of
> PHP bug?
It does seem to be a disagreement with the manual:
http://www.php.net/manual/en/language.operators.errorcontrol.php
There it says that you can stick @ before a variable name.
miguel