Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After enabling queries logging ($conf['dev_query'] = true) I see PHP notice message:
Notice: Trying to get property of non-object in ...\includes\database.mysqli.inc on line 103
My issue is to change str 103 to:
$name = isset($user->name) ? $user->name : variable_get('anonymous', 'Anonymous');
Comments
Comment #1
gpk CreditAttribution: gpk commentedThe original code was:
Generally global $user exists, except there are perhaps 2 queires during bootstrap before $user is properly instantiated - the first in http://api.drupal.org/api/function/drupal_is_denied/6 and the 2nd (the one used to create $user) in http://api.drupal.org/api/function/sess_read/6.
I'm not sure that these queries should really be attributed to the anon user? But what else to use?
Comment #2
gpk CreditAttribution: gpk commentedActually it is probably worth having a look at/play with devel.module which is what the query logging functionality was originally aimed at.
Comment #3
Dave ReidIt should probably be something like the following:
But that seems...kinda convoluted.
Comment #4
shp CreditAttribution: shp commentedYes, this 2 bootstrap phases (access & session) passed by all users, if fastpath_cache is not used.
No, I want to have more precise performance info.
Comment #5
shp CreditAttribution: shp commentedComment #6
Damien Tournoud CreditAttribution: Damien Tournoud commentedI don't believe this bug magically disappeared.
Comment #7
Damien Tournoud CreditAttribution: Damien Tournoud commentedAnd clarifying the title.
Comment #8
shp CreditAttribution: shp commentedYes, this bug didn't disappeared :) I supposed that if it is not fixed yet, I should to close the issue. So, thank you for hint.
Comment #9
shp CreditAttribution: shp commentedComment #10
multiplextor CreditAttribution: multiplextor commentedClosed. The reason: expired.
Comment #11
jwilson3How is "expired" a reason to close this issue?
I still have this issue, and actually just filed a separate bug report, which I've now mark as a duplicate of this one:
#2623902: dev_query broken with early db queries
Comment #12
jwilson3Found yet another dupe:
#367274: Trying to get property of non-object in [www]\includes\database.mysqli.inc on line 102
Comment #13
jwilson3Aaaaand another one, that actually has a patch.
#351844: Early mysql queries generate notices when query logging is enabled
FWIW, the patch there is a simplified version of what Dave Reid suggested in comment #3 above.
Comment #14
jwilson3I think we should close this issue, even though it has more followers and comments from respected community members, because #351844 already has a patch, while this one does not. This is so that the person who worked on that patch would get credit were it ever to get committed.
Comment #15
jwilson3