But there is a very valid security concern here. People can usually run
safely with display_errors enabled if their code is well-written. They
Oh no. Nobody should or can safely run production with display_errors.
Everybody thinks their code is well-written, but display_errors should
never be enabled in production, however high is your opinion of the code.
I'm afraid people now will start quoting this saying "ok, yeah, if
you're a bad programmer, disable display_errors, but I'm a good
programmer, my code is solid, I even have a dozen of unit tests, so I
just go ahead and enable display_errors" and then we have this sad state
of affairs where sites spill out error messages that are never supposed
to be seen by clients because developers thought it can never happen.
The alternative is to just not have any error message at all. That
avoids the discrepancy between the error messages with display_errors on
I don't think it's a good idea to add such magic, as correctly noted, it
will make people that are working properly - display off in production,
on in development - work harder and have trouble, all in the name of
cuddling people that run misconfigured servers and ignore the advice
that is being repeated for years by now.