VersionX icon indicating copy to clipboard operation
VersionX copied to clipboard

PHP Fatal error on migration script

Open krismas opened this issue 1 year ago • 2 comments

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

krismas avatar Mar 18 '24 19:03 krismas

Do you know if the fields value for that object is empty? Does it work if you change that line to: $object->get('fields') ?? [],?

muzzwood avatar Mar 21 '24 04:03 muzzwood

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.

krismas avatar Mar 26 '24 21:03 krismas