On 13/12/2022 12:53, Dan Liebner wrote:
It breaks my app. Does that count?


The only way a Warning can break an application is if you're running a custom handler which promotes it to an error. If that is your case, then blaming PHP is a little bit like programming your car to do an emergency stop at every road sign, then complaining to the highways agency when someone runs into the back of you.

On the other hand, in keeping with my earlier suggestion of making valid use cases easy, PHP could help by making it easier to filter messages in that callback. At the moment, you'd have to match the content of the message, which is not ideal; a unique code for each message type would be much nicer, but there's potentially quite a lot of initial work to assign codes to all the existing messages.

That way, you could promote some warnings to errors, and ignore others; or log them with your own choice of severity, possibly not even limiting yourself to those that PHP provides.

Of course, this won't help in the long run for things which eventually do become errors, but for everything below that level, it would be much more powerful than a one-off setting to change the severity of one specific message.

Regards,

--
Rowan Tommins
[IMSoP]

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

Reply via email to