In D6 the admin form for setting 'error_level' is defined as:'#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen'))
so error_level = 0 for writing errors just to the log, and error_level = 1 for writing to the log and screen.
In D7 the settings are done by constants:
'#options' => array(
ERROR_REPORTING_HIDE => t('None'),
ERROR_REPORTING_DISPLAY_SOME => t('Errors and warnings'),
ERROR_REPORTING_DISPLAY_ALL => t('All messages'),
),
which have the values 0, 1 and 2.
In the D6 version of backtrace_error_handler() we test for error_level == 1 when determining whether to display the backtrace. This is fine, but in D7 the same code is used, which means we only get the backtrace when the option 'Errors and Warnings' is selected, and it is not displayed for the more comprehensive option 'All messages'.
Therefore I suggest the test in D7 is changed from
if (variable_get('error_level', 1) == 1) {
to
if (variable_get('error_level', 1) != ERROR_REPORTING_HIDE) {
If others agree to the change I will make a patch, but I might wait for #1163356: New error handling option: Backtrace and normal message because whichever is committed first, then the other patch will need to be re-rolled.
Jonathan
Comments
Comment #1
salvisWhat's the path where those options are displayed?
This does look like a porting bug. The default will have to be replaced, too.
Comment #2
jonathan1055 commentedIn D7 the link is /admin/config/development/logging and in D6 it is /admin/settings/error-reporting. Conveniently an active link is displayed in the paragraph right beneath the Devel error option :-)
Comment #3
salvisGot it.
The downside of using named constants is that we must guarantee that errors.inc has been included. Loading an include file inside an error handler (where we're not sure in what context we're running) is not so great.
After some thought I lean toward keeping the magic numbers and fixing only the actual porting bug:
Comment #4
jonathan1055 commentedYes I see your point exactly, and you have added a comment saying where the 1 came from, so it is traceable.
I presume you are going to fix this yourself, you don't need me to make a patch.
Comment #5
jonathan1055 commentedoops, I should not have set the status to Reviewed and tested, until an actual patch file has been run.
Comment #6
salvisCommitted to D7 and D8. Thanks!