Posted by Pasqualle on October 10, 2008 at 9:22pm
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | theme system |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Dave Reid |
| Status: | closed (fixed) |
Issue Summary
Notice: Trying to get property of non-object in drupal-6.5\includes\theme.maintenance.inc on line 250
Notice: Undefined property: stdClass::$language in drupal-6.5\themes\garland\maintenance-page.tpl.php on line 16
when mysql is off and error_reporting = E_ALL in php.ini..
note: this is displayed by the server not as a Drupal error message..
Comments
#1
Wait...mysql is off?
#2
yes, the mysql server was turned off when I saw the php notice on the maintenance page.. I did not tested further, if it is necessary to reproduce the bug..
#3
I can duplicate this error. It's because Drupal can't connect to the database (I changed my database connection info in settings.php to an invalid database), so Drupal is not really at fault. You still get the Drupal maintenance page right? I guess we could be a little better at not showing non-fatal errors.
#4
Found a fix...patch coming shortly.
#5
The function _db_error_page does not call drupal_init_language, which is causing the PHP notice on global $language. If you take a look at install_main and update.php, they both do a bootstrap to DRUPAL_BOOSTRAP_CONFIGURATION, and call drupal_init_language() right before the call to drupal_maintenance_theme(). We need to do the same thing on _db_error_page to prevent this PHP notice.
Steps to reproduce this error:
- Have a valid, already installed Drupal ready
- Change your settings.php to an invalid database
- The db error page shows PHP notice
Attached are very little patches for D7 and D6. I have confirmed that in D6 this fixes the bug, there is some logic error in D7 that instead of showing a db down page, it goes back to install.php (which calls drupal_init_language). This should be RTBC.
#6
I should leave this on 6.x since that's where this can be fixed first, then we can worry about 7.x
#7
Ideally there should just be a drupal_init_language call made in _drupal_maintenance_theme since we need to do it every time we call drupal_maintenance_theme, but that should probably be a separate issue.
#8
tested on D6.5
the notice is gone after the patch..
#9
Marking as RTBC. Can't really test this...
#10
Dave, you shouldn't mark it RTBC for your own patch.
I did test it though and it works though so RTBC by me.
No, that wouldn't be right since the maintenance page could already have been through a bootstrap when updating and the late phases of the initial install. They all funnel through that same function. Your current patch is fine.
#11
Sorry dvessel. Sometimes I get a little trigger-happy. :)
#12
Committed to Drupal 6. Moving to Drupal 7.
#13
Committed to CVS HEAD as well. Thanks.
#14
Automatically closed -- issue fixed for two weeks with no activity.