PdoBackend cannot handle uninitialized SplObjectStorage properties
Properties with a declared type of
SplObjectStorage that have a NULL value break persistence.
In my application, I have two models: accounts and users. Account models have a property like this:
/** * @var \SplObjectStorage<\F3\MyApp\Domain\Model\User> */ protected $users;
Prior to upgrading the FLOW3 source, I was able to persist Account objects without setting the $users property. After upgrading, attempts to persist accounts fail with this error:
#1: Catchable Fatal Error: Argument 1 passed to F3\FLOW3\Persistence\Backend\PdoBackend::processSplObjectStorage() must be an instance of SplObjectStorage, null given, called in /opt/local/apache2/htdocs/tutorial/Packages/Framework/FLOW3/Classes/Persistence/Backend/PdoBackend.php on line 247 and defined in /opt/local/apache2/htdocs/tutorial/Packages/Framework/FLOW3/Classes/Persistence/Backend/PdoBackend.php line 388 (More information)
For now, I've fixed it by setting users to an empty SplObjectStorage instance in the User constructor.