diff --git a/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php b/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php index 1f0ad9f33634f9d3b1a49bf801fff8af490c36e9..9c391c366123134cdc831d8e7e5683fc3846b19d 100644 --- a/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php +++ b/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php @@ -128,7 +128,9 @@ abstract class AbstractDomainObject implements DomainObjectInterface, ObjectMoni */ public function _getProperty(string $propertyName) { - return $this->{$propertyName}; + return $this->_hasProperty($propertyName) && isset($this->{$propertyName}) + ? $this->{$propertyName} + : null; } /** @@ -262,7 +264,7 @@ abstract class AbstractDomainObject implements DomainObjectInterface, ObjectMoni } } } else { - if ($this->isPropertyDirty($this->_getCleanProperty($propertyName), $this->{$propertyName}) === true) { + if ($this->isPropertyDirty($this->_getCleanProperty($propertyName), $this->_getProperty($propertyName)) === true) { return true; } } diff --git a/typo3/sysext/extbase/Tests/Functional/Persistence/IsDirtyTest.php b/typo3/sysext/extbase/Tests/Functional/Persistence/IsDirtyTest.php index 15b90eefa68e3f6f2b92015ed7eba24aed75d16c..1fcea447f8985b383decf890bdbd940172413e52 100644 --- a/typo3/sysext/extbase/Tests/Functional/Persistence/IsDirtyTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Persistence/IsDirtyTest.php @@ -133,4 +133,13 @@ class IsDirtyTest extends FunctionalTestCase $updatedBlogOne = $this->blogRepository->findByUid(3); self::assertSame($updatedBlogOne->getAdministrator()->getUid(), $blogTwo->getAdministrator()->getUid()); } + + /** + * @test + */ + public function undefinedPropertyIsAlwaysClean(): void + { + $blogOne = $this->blogRepository->findByUid(1); + self::assertFalse($blogOne->_isDirty('undefinedProperty')); + } }