Re: [PATCH] #52563: Adding E_NONE and/or E_EVERYTHING constants
| From: | Tyler Lawson | Date: | Wed, 25 Aug 2010 13:51:20 +0000 |
| Subject: | Re: [PATCH] #52563: Adding E_NONE and/or E_EVERYTHING constants | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49514@lists.php.net to get a copy of this message | ||
Sebastian Bergmann wrote:
> So nobody will use E_DEVELOPMENT or E_NONE or whatever. We can only add
> options to PHP that offer choices to developers. If they do not use
> them ... what can we do?
>
As a regular user of PHP, I like the idea of E_DEVELOPMENT and
E_PRODUCTION. They're clear and will do what I would expect them to.
Why not change the default php.inis to those values instead?
I'm a against E_NONE, though. Now, I understand what a bit mask is, but
imagine for a second that I didn't. Imagine that I want no messages
except for E_ERROR. As a theoretically less experienced developer, I
might assume that I should explicitly turn off all errors except for
E_ERROR. What does that get me? error_reporting(E_NONE & E_ERROR).
Oops. That doesn't work as I expect it to!
Using a '0' makes it painfully obvious that it's not meant to combine
with the other predefined constants. 0 is special. 0 doesn't play
nicely with others.
This is obviously an edge case, and a less experienced developer would
hopefully learn very quickly the right way to do it, but I don't like
the idea of giving people ammo to shoot at PHP and its wacky E_* constants.
--
Tyler Lawson