User tests: Successful: Unsuccessful:
Logged user is stored in session.
Session is serialized.
JUser object has __wakeup() method which loads logged user from database
Once session is loaded, __wakeup() loads user from database
Any next attempt to get logged user via JUser::getInstance() loads user from database again because internal JUser::$instances[] cache is empty.
So, we have extra 2 DB queries on each page load.
Push the logged user loaded on session unserialize into JUser::$instances[]
Enable debug
Login in frontend.
By default there are 6 duplicated queries - see 3 attempts to load user and 3 attempts to load usergroups.
1st user load is executed on session unserialize
2nd user load is executed on current user get via JFactory::getUser()
3rd user load is executed on session unserialize called by debug plugin to display session data. Note that this user load is only executed with debug enabled.
Apply patch.
See 2 user load attempts only (previous 2nd has gone).
Besides: we should also check if load() was successfull in JUser::__wakeup(), otherwise deleted user will still exist in session.
| Category | ⇒ | Libraries |
| Status | New | ⇒ | Pending |
| Labels |
Added:
?
|
||
I have tested this item
| Status | Pending | ⇒ | Ready to Commit |
RTC after two successful tests.
| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-11-01 11:58:42 |
| Closed_By | ⇒ | mbabker | |
| Labels |
Added:
?
|
||
I have tested this item✅ successfully on 13e9bc4
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17310.