The removal of db_is_active #688294: Switch from db_is_active() to proper exception catching results in notices being generated as function_exists for user_access check in theme.inc is returning true.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ctmattice1’s picture

I received the error messages as well. The Install proceeds and completes correctly.

The errors stems from user.module, line 692

[code]
// User #1 has all privileges:
if ($account->uid == 1) {
return TRUE;
}
[/code]

$account is not available, (not set??) since this is an install. Not sure where in the bootstrap process though to set $account, guess it could be done here by checking for install on the order of something like this.

[code]

if (MAINTENANCE_MODE === 'install') {
// This is an install give full privileges
$account->uid == 1;
return TRUE;
} else {
// User #1 has all privileges:
if ($account->uid == 1) {
return TRUE;
}
}

Haven't tried the code yet, brainstorming..., might need to set $user instead

marcingy’s picture

The error is cause in theme.inc as detailed in #1 and happens because the check for function exists fails, the code in user_access should never be executed, no changes should be required in the user module itself.

marcingy’s picture

Status: Active » Needs review
FileSize
751 bytes

Rework what we check on to see if we have databse given that user_access is an available function. Instead we can test if the $user object has a uid property or not.

rich.yumul’s picture

I reviewed the patch and it worked for me. :) No more "Notice: Trying to get property of non-object in user_access() " errors when I installed d7-head.

DrupalCon inspired me to get more involved, so this is my first patch review. If I'm supposed to do something different, please let me know, or point me to the right docs that explain it... :)

andypost’s picture

marcingy’s picture

Cool - @rich.yumul you want to mark rtbc and that might get a few more eyes on the issue if I'm going down the wrong track

tobiasb’s picture

Status: Needs review » Reviewed & tested by the community
Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

andypost’s picture

Status: Fixed » Needs work

@marcingy please return back this check and just add your change! Take care to read #766100: Undefined function _system_rebuild_theme_data when trying to run update.php from D6 -> D7

_template_preprocess_default_variables() is used also in maintenance mode where user.module could not be loaded but $user->uid is set.

marcingy’s picture

Status: Needs work » Needs review
FileSize
855 bytes

New version taking into account comments in #9.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Let the bot come green

Status: Reviewed & tested by the community » Needs work

The last submitted patch, themes-notice.patch, failed testing.

tobiasb’s picture

Status: Needs work » Needs review
FileSize
881 bytes

reroll

marcingy’s picture

Status: Needs review » Reviewed & tested by the community

Again if the bot is green this will be good to go.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work

Please wrap code comments at 80 characters.

Other than that: I guess this patch is OK for the purposes of this issue, but we really really really need to find a way to stop doing this kind of thing :) The installer/maintenance theme code is so complex that no one actually understands it, and all these special conditions make it impossible to follow what is going on. I think these two variables should be added by user.module (rather than hardcoded into the main template preprocessor), and the installer should not be "fake-loading" the user module at all but rather only loading it via the normal methods once a database connection is established. In that case we'd be able to remove both of these checks. Save that for another issue, I guess...

aspilicious’s picture

FileSize
881 bytes

Wrapped comments

aspilicious’s picture

Status: Needs work » Needs review
webchick’s picture

Status: Needs review » Fixed

Committed this patch to HEAD as well, to stop notices since I'm about to roll a new alpha. But I agree with David Rothstein that we're treading down a slippery slope of unmaintainability here. A new issue (cross-linked here) discussing a more sane/centralized way to do this would be good.

David_Rothstein’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.