Em 2012-09-03 23:54, Stas Malyshev escreveu:
Hi!

indicating such mental model is widespread and (2) given that the
exceptions you claim to be surprising don't happen but for a programming
error (i.e. they're not exceptions that need to be caught).

Following this logic, we'd have to convert all E_NOTICE and E_STRICT to
fatal errors or exceptions - they are usually produced by programming
errors and aren't meant to be caught by surrounding code (actually,
can't). But I don't see anybody benefiting from this - as I don't see
anybody benefiting from generator that will explode your application if
you touch it twice.


That does not follow at all.

First, E_NOTICE exists to permit a compromise between people like Zeev that think its introduction was an error and that one should be able to refer to undefined variables and people who prefer a stricter model. For the programmers that follow this stricter model, an E_NOTICE ends ups frequently being a fatal (because, for instance, you invoke a method on the resulting null); some other times you're lucky and you just missed an "else $var = null" branch, other times the error is far more serious, like an unintended null -> 0 conversion.

Second, E_STRICT exists to encourage good OOP practices. There is a lot of code that generates E_STRICT that does what it was intended to do (ask Lester). By definition, code that's not supposed to generate E_STRICT messages but does is buggy, but the fact that some code raises an E_STRICT does not signal, by itself, a bug.

--
Gustavo Lopes

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to