-
Notifications
You must be signed in to change notification settings - Fork 189
Description
Summary
Version 12.5.4 introduced @Lazy annotations in PR #1246 to fix a memory leak. However, this change breaks page caching with PHP 8.x due to strict type enforcement during unserialization.
TYPO3 / PHP Version
- TYPO3: 12.4.39
- PHP: 8.1.33
- Powermail: 12.5.4 (works with 12.5.3)
Steps to Reproduce
- Create a Powermail form with fields
- Add the form to a page
- Enable page caching (or use USER_INT content on the page)
- Visit the page
Expected Behavior
The page renders correctly with the Powermail form.
Actual Behavior
500 error with TypeError:
Cannot assign null to property TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject::$_cleanProperties of type array
Full stack trace:
#0 /var/www/html/vendor/typo3/cms-frontend/Classes/Controller/TypoScriptFrontendController.php(2296): unserialize()
Root Cause Analysis
PR #1246 added @TYPO3\CMS\Extbase\Annotation\ORM\Lazy to:
Classes/Domain/Model/Form.php→$pagespropertyClasses/Domain/Model/Page.php→$fieldsproperty
When Powermail domain objects (Form → Page → Field) are serialized for caching, the LazyLoadingProxy objects don't serialize properly. During unserialization, the _cleanProperties property (typed as array in AbstractDomainObject) receives null instead of an empty array.
PHP 8.x strict typing then throws the TypeError because null cannot be assigned to a property typed as array.
Workaround
Downgrade to Powermail 12.5.3:
Suggested Fix
The @Lazy annotation approach needs to be reconsidered for compatibility with:
- Page caching / serialization
- PHP 8.x strict typing
Possible solutions:
- Implement
__sleep()and__wakeup()methods to handle serialization properly - Use a different approach to prevent the memory leak that doesn't involve lazy loading on these specific properties
- Ensure
_cleanPropertiesis initialized as empty array[]after unserialization