Re: Should I care about these errors?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/11/5 Angus Mann <angus@xxxxxxxxxxxxx>:
> Hi all. I find that when I turn on strict error reporting:
> ERROR_REPORTING(E_ALL);
> I see all sorts of errors in scripts that otherwise work just fine.
>
> The most common I guess is "Use of undefined constant".
>
> I know where the errors come from and I know how to stop them, but I guess
> my question is "Should I bother?" Is there really any any harm if I write:
>
> $price = 100;
>
> without first defining $tennis as a string, or an integer or whatever?

$tennis? That's not even mentioned in your example.

In general, yes. In rough, no. Notices tell you where you are making
basic coding mistakes but do not necessarily indicate problem with the
way the code will actually execute. However, from your example, it's
impossible to say whether what you're seeing actually represents a
problem with the code you're writing.

'Undefined constant' notices usually mean you've used an unquoted
string, which will be a problem if, for example, another part of the
code defines a constant with the same name as the unquoted string in
your code.

Pay attention to the notices. Again, your code might execute fine with
notices thrown everywhere, but they often indicate sloppiness which
can come back to bite you in hard-to-debug ways later on.

If you post a more complete example it will be easier to help you.


Regards,

Torben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux