PHP Fatal error on migration script
We encountered the following error when running the migration code:
PHP Fatal error: Uncaught TypeError: Return value of mergeTVs() must be of the type array, null returned in /home/ackwa/sites/v3/core/components/versionx/migrate.php:226
Stack trace:
#0 /home/ackwa/sites/v3/core/components/versionx/migrate.php(83): mergeTVs()
#1 /home/ackwa/sites/v3/core/components/versionx/migrate.php(36): createDelta()
#2 {main}
thrown in /home/ackwa/sites/v3/core/components/versionx/migrate.php on line 226
After a quick analysis, it seems that the problem is caused by a deserialization error when calling $object->get('fields') which then returns null.
Environment :
- MODX : 2.8.6
- VersionX : 3.0.1-pl
- PHP : 7.4.33
Do you know if the fields value for that object is empty?
Does it work if you change that line to: $object->get('fields') ?? [],?
The value of the field was not empty, but the serialization was in error (ie unserialize(): Error at offset...).
Does it work if you change that line to:
$object->get('fields') ?? [],?
I made a change similar to the one you suggest in order to solve the problem until a permanent fix is found.