Skip to content
Snippets Groups Projects
Commit d762ea3b authored by Torben Hansen's avatar Torben Hansen Committed by Nikita Hovratov
Browse files

[BUGFIX] Harden Extbase LazyLoadingProxy


When a domain model object has a lazy loading property (e.g.
relation to another domain model object), the
`AbstractGenericObjectValidator` may fail validation the
domain model, if the database record for the related object
has been deleted.

This change fixes the problem by adding a null safe operator
to the `$realInstance` variable in the magic `__get` call
in LazyLoadingProxy. The return type for `_loadRealInstance`
has been adapted, since the function actually can return
`null`. This allows the removal of an entry in the phpstan
baseline file.

Additionally a todo in `AbstractGenericObjectValidator` has
been removed, since the function actually supports lazy
loading proxies as the initial error shows.

Resolves: #101400
Releases: main, 12.4
Signed-off-by: default avatarTorben Hansen <derhansen@gmail.com>
Change-Id: Ib39da09fdc94ef529f672af7f948d6a7fd82e531
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80104


Tested-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: default avatarAlexander Schnitzler <git@alexanderschnitzler.de>
Reviewed-by: default avatarNikita Hovratov <nikita.h@live.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarAlexander Schnitzler <git@alexanderschnitzler.de>
Tested-by: default avatarNikita Hovratov <nikita.h@live.de>
parent ba3dd0c2
Branches
Tags
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment