{{ message }}
Repository navigation
[5.4] Fix the inverted existence check when creating session metadata - #48562
Open
ManoharPaturi wants to merge 1 commit into
Open
ManoharPaturi wants to merge 1 commit into
ManoharPaturi wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pull Request resolves #
Summary of Changes
MetadataManager::createRecordIfNonExisting()checks whether a session metadata record exists before inserting it. The guard compares against the wrong constant:With this comparison the method returns when no record was found and only attempts the insert when a record is already present, which is the opposite of both the method name and the comment above the guard. The insert for an existing record then fails on the primary key and the failure is swallowed, so in practice the method has never created anything.
This PR compares against
self::$sessionRecordDoesNotExistinstead, so the record is inserted when it is missing. When the state cannot be determined because the existence query failed, nothing is written, matching the conservative handling increateOrUpdateRecord().The method currently has no callers in the core code base, so no behavioural change is expected anywhere in the CMS; it is public API of a class marked
@internaland should behave as documented for any consumer. A unit test class is added covering the missing, existing and undetermined record states; two of the three cases fail against the previous guard.Testing Instructions
Run the new unit tests:
Actual result BEFORE applying this Pull Request
createRecordIfNonExisting()inserts nothing when the metadata record is missing and attempts a duplicate insert when it already exists, which fails on the primary key.Expected result AFTER applying this Pull Request
createRecordIfNonExisting()inserts the metadata record when it is missing, does nothing when it exists, and does nothing when the record state cannot be determined.Link to documentations