IBX-11842: Fixed SiteAccessAwareEntityManager::find() ignoring lock mode and lock version#777
Open
alongosz wants to merge 2 commits into
Open
IBX-11842: Fixed SiteAccessAwareEntityManager::find() ignoring lock mode and lock version#777alongosz wants to merge 2 commits into
alongosz wants to merge 2 commits into
Conversation
The decorator narrowed EntityManagerInterface::find() to two parameters, so callers requesting a pessimistic or optimistic lock (e.g. LockMode::PESSIMISTIC_WRITE) silently got no lock and no error. The arguments are now forwarded to the wrapped entity manager, the same way Doctrine\ORM\Decorator\EntityManagerDecorator does. Added a scoped PHPStan ignore, as ObjectManager::find() declares only two parameters in both doctrine/persistence v2 and v3. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
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.



Related PRs:
Description:
Ibexa\Core\Persistence\Doctrine\SiteAccessAwareEntityManager::find()declared only($className, $id), silently dropping the$lockModeand$lockVersionparameters of Doctrine'sEntityManager::find(). Any caller requesting a pessimistic lock, e.g.$em->find(TaxonomyEntry::class, $id, LockMode::PESSIMISTIC_WRITE), got no lock and no error — the intendedSELECT … FOR UPDATEwas never executed. Discovered while investigating IBX-11842 (taxonomy nested-set insert deadlocks), where the pessimistic lock was silently skipped.The method now accepts and forwards both parameters to the wrapped entity manager, matching
Doctrine\ORM\Decorator\EntityManagerDecorator::find().The rest of the decorator was audited against the interface: no other method narrows its signature (
refresh()already forwards$lockMode,lock()forwards all arguments).A scoped PHPStan
ignoreErrorsentry was added, becauseDoctrine\Persistence\ObjectManager::find()declares only two parameters in both persistence v2 and v3 — the same false-positive class as the existingclear()entry inphpstan-baseline-doctrine-persistence-v3.neon.For QA:
Covered by unit tests. Functional check: according to IBX-11842 steps, together with ibexa/taxonomy#423 PR.
Regression run: