Problem/Motivation
CssCollectionOptimizerLazy and JsCollectionOptimizerLazy both call methods on an inherited state member variable that has been removed.
Steps to reproduce
Install Drupal 10.2.2 with Flysystem 2.2.x (I used commit b80a666 at the time of replicating the issue) and flysystem_s3 2.1.1. Attempting to rebuild cache through drush results in the error
Undefined property: Drupal\flysystem\Asset\CssCollectionOptimizerLazy::$state CssCollectionOptimizerLazy.php:19
If the usage of state at that line is removed and drush cr is run again, then a similar error is raised.
Fatal error: Uncaught Error: Call to a member function delete() on null in /var/www/html/docroot/modules/contrib/flysystem/src/Asset/JsCollectionOptimizerLazy.php:19
Proposed resolution
Remove the references to state in these classes.
Remaining tasks
All the things.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork flysystem-3415603
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
eli-tComment #4
eli-tComment #5
bbombachiniI was having the same problem and your patch resolved.
Comment #6
luigisa commentedI was having the same problem and your patch resolved.
Comment #7
eli-tOne thing to consider here is if the code the MR removes is still required in < 10.2, and whether we should check versions or actually enforce > 10.2 in the next releases composer.json. I'd be interested in what the module maintainers opinions are there.
Comment #8
goldI just hit this on an upgrade from 10.1 to 10.2 and the patch of MR46 resolved this for me.
I would consider this RTBC but agree with @Eli-T on the unknown consequences for those still on 10.1 so won't update the Status.
Comment #9
mikeyburnthebook commentedI just hit this issue on an upgrade from 10.0 to 10.2 and the patch in MR-46 resolved the issue for me. Would love to see this merged so we don't have to patch. Thanks!
Comment #10
kalpaitch commentedI have tested this with a migration from 10.1 to 10.2.
This is a non-breaking change, thanks for @Eli-T for adding the note of cation, but 10.2 will not use the state for caching the asset filename see this comment from #3301573: Remove the aggregate stale file threshold and state entry:
Good to merge, have upgraded to major because flysystem will not work with 10.2 without it.
Comment #11
lisa.rae commentedComment #13
lisa.rae commentedComment #14
lisa.rae commented