? Pending

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
3 Jan 2019

Partial Pull Request for #17405 (comment)

Summary of Changes

  • Works around a design flaw in the database API's handling of parameterized query values that disallows null values (probably because so much of the CMS application uses some form of NOT NULL (DEFAULT ...) statement on most of the schema) preventing metadata from being inserted for guest users
  • Adds a createOrUpdateRecord method to the MetadataManager and uses it over the createRecordIfNonExisting method (as the session API correctly inserts records to the database in 4.0 and this insert generally occurs before the session's start event is fired, more often than not the update path here is going to be used when the database handler is in use and the create path only executed when the session is initially created for other handlers; note this should now also mean the timestamp is more accurate when not using the database handler)
  • Adjusts the priority of the application's afterSessionStart listener for the SessionEvents::START event so it always runs before the metadata manager
  • Registers a listener for SessionEvents::START to ensure the metadata manager is fired
    • This bit is hacky as all hell because doing it right gets into dependency hell (a proper event listener has a dependency to the MetadataManager, the MetadataManager has a dependency to the database, the database has a dependency to the event dispatcher, and when building the dispatcher service generally you'd have something like foreach ($container->getTagged('event.subscriber') as $subscriber) { $dispatcher->addSubscriber($subscriber); } in that service's callback, and that's the bit that would trigger a circular dependency problem and either the Container catches that and throws an error or PHP errors out with a maximum nesting related message)

Testing Instructions

  • Apply patch to a 4.0 install
  • Ensure session metadata is correctly written at the start of each request when metadata is enabled
  • Ensure no metadata writes are made when the option is disabled (global config)
avatar mbabker mbabker - open - 3 Jan 2019
avatar mbabker mbabker - change - 3 Jan 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Jan 2019
Category Libraries Front End Plugins
avatar wilsonge wilsonge - change - 6 Jan 2019
Labels Added: ?
avatar wilsonge wilsonge - change - 6 Jan 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-01-06 19:41:06
Closed_By wilsonge
avatar wilsonge wilsonge - close - 6 Jan 2019
avatar wilsonge wilsonge - merge - 6 Jan 2019
avatar wilsonge
wilsonge - comment - 6 Jan 2019

I tested this before merging with and without session metadata parameter enabled and nothing obviously appears to be broken at a quick navigation around the CMS and also ensuring that the metadata indeed isn't stored in the session table

Add a Comment

Login with GitHub to post a comment