Re: Is there any way that PHP will issue a warning when using undeclared vars?
| From: | Rory Browne | Date: | Mon, 03 Jan 2005 01:18:48 +0000 |
| Subject: | Re: Is there any way that PHP will issue a warning when using undeclared vars? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-205480@lists.php.net to get a copy of this message | ||
Unless I'm mistaken, which is quite possible considering that its been
years since I set my error_level, to anything other than E_ALL, but I
think you need to 'bitwise or' the error_levels instead of 'bitwise
and' them.
The default setting IIRC is E_ALL & ~E_NOTICE, which means all errors
except E_NOTICE. I think what you're looking for is simply E_ALL, but
so long as it can emit E_NOTICE's you should be okay.
On Sun, 2 Jan 2005 16:23:34 -0800, Dan Eloff <dan.eloff@gmail.com> wrote:
> My single biggest beef with PHP is the fact that it silently fails
> when I use a variable that has never been declared. Like if($sumbit)
> will always be false because the variable was really named $submit. My
> only clue that this is happening is whe the program fails to work as
> intended and I waste lots of time trying to find out why the block
> never executes.
>
> Or if you forget to use $this->var and you just use $var. I just had
> that happen to me too. Wasted another 30 min.
>
> Is there any way at all to control this? I went into my PHP.ini file,
> but my errors are set to E_ALL & E_STRICT which seems to be the
> highest level I can set.
>
> If not I think we should seriously push for E_STRICT warnings if a
> variable is used without every being assigned to.
>
> Happy New Year All
> -Dan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>