Closed izica closed 5 months ago
$this->mediaConversions = [
...(is_array($actualMediaConversions) ? $actualMediaConversions : []),
...(is_array($preparedMediaConversions) ? $preparedMediaConversions : []),
];
Sometimes when opcache+jit is enabled, somehow $actualMediaConversions
or $preparedMediaConversions
are false
, not array.
This happens only with singleFile
collections.
I inherited this trait and overridden method with a quick fix.
Perhaps this is happening because I am using methods getRegisteredMediaCollections
and getMediaCollection
in custom attributes, and this registers the collections on every call $this->registerMediaCollections();
Also I tried to separate conversion to registerMediaConversions
method, but the error still repeats.
Looks hard to reproduce: if anyone is also experiencing this let us know, I'm wondering how many users it's impacting.
I would be happy to accept a PR if something can be improved on our side.
Im running into this while adding
->withManipulations([ 'avatar' => [ 'manualCrop' => "custom props here", ], ])
during the adding of media to a single file collection with a registered media conversion
After turning on opcache+jit, after some time an error occurs:
/var/www/backend/vendor/spatie/laravel-medialibrary/src/InteractsWithMedia.php:607
Only arrays and Traversables can be unpacked
this only happens after some time(5+ mins of requests), when opcache+jit is enabled in logs $actualMediaConversions === false (only after opcache+jit)
Code and settings: