Closing, because while looking for an alternative solution I discovered the extraordinary complexity of such a request and I wonder if it’s even possible. Nevermind!
@plaidpowered I went down that road too 😅
In the case of an *actual* fatal error, you will get a backtrace included automatically (it’s part of the message returned by error_get_last()). That’s because FEN is triggered directly as a result of the error.
But for warnings and other stuff, calling debug_backtrace() doesn’t work since the error may have happened a long time ago.
We looked into registering a custom error hander using set_error_handler() instead, but it can conflict with other plugins that are doing the same thing… and we couldn’t guarantee 100% reliability.
So, that’s the way it is (for now). But if anyone finds a way to reliably get a backtrace for all error types I’d love to hear it 🙂
There’s long discussions on the PHP set_error_handler documentation comments about this, and at least one super long Stack Overflow thread, PHP simply doesn’t seem designed to provide the info we need unless Xdebug is installed. By the time the error gets to the error handler callback, the backtrace has already been lost. Makes it real fun to track down deprecation warnings in production…
Thanks for replying, if someday I find a solution (probably won’t until the PHP function itself changes) I’ll be sure to let you know.