Issue Bug Closed

#99463non-static access to static property in AbstractDomainObject.php line 272

Oliver Eglseder 01/05/23, 10:34 updated 07/09/24, 21:29

Description

Error:

PHP Notice: Accessing static property <class>::<property> as non static in [...]/typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php line 272

Should be easily reproducable by adding a static property to any domain model (e.g. protected static array $sharedRuntimeCache = [];) and then dumping it via the extbase DebuggerUtility::var_dump

Solution proposal:
Before:

            if ($this->isPropertyDirty($this->_getCleanProperty($propertyName), $this->{$propertyName}) === true) {
                return true;
            }

After:

            $reflectionProperty = new ReflectionProperty(static::class, $propertyName);
            if ($reflectionProperty->isStatic()) {
                $value = static::$$propertyName;
            } else {
                $value = $this->{$propertyName};
            }
            if ($this->isPropertyDirty($this->_getCleanProperty($propertyName), $value) === true) {
                return true;
            }

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Files 2

History 4

  1. Oliver Eglseder commented and changed attached typo3-extbase-abstractdomainobject-static-access.patch 01/05/23, 10:44

    This patch should do it.

  2. Georg Ringer changed Sprint Focus On Location Sprint 06/19/24, 22:05

  3. Georg Ringer commented and changed attached Bildschirmfoto 2024-06-20 um 07.43.22.png status New Needs Feedback 06/20/24, 05:45

    Bildschirmfoto%202024-06-20%20um%2007.43.22.png

    seems to work in at least v13, can you retest this if it still doesn’t for you? thanks

  4. Georg Ringer commented and changed status Needs Feedback Closed 07/09/24, 21:29

    closing issue as it couldn’t be reproduced and lack of feedback. if still valid in v12, either contact me on slack or open a new issue and reference this one.