- Issue created by @obomevelhomax
- Status changed to Needs review
over 1 year ago 3:37pm 13 September 2023 - last update
over 1 year ago 103 pass - Status changed to Closed: won't fix
over 1 year ago 4:21pm 13 September 2023 - πΊπΈUnited States lhridley
Per the warnings you included, this appears to be an issue occuring within Drupal Core, not Flysystem, and should be addressed there.
FlysystemBridge does not set any variables called "context", nor does the parent class, Twistor\FlysystemStreamWrapper.
- πΊπ¦Ukraine blade_ukraine
That patch also works for my case:
Deprecated function: Creation of dynamic property Drupal\flysystem\FlysystemBridge::$context is deprecated in Drupal\image\Controller\ImageStyleDownloadController->sourceImageExists() (line 247 of core/modules/image/src/Controller/ImageStyleDownloadController.php).
- π¨π¦Canada adam-vessey PE, Canada
Bit of poking around, looks like this might be actually be an expectation of PHP proper, that a public
$context
property exists on stream wrapper implementations: https://www.php.net/manual/en/class.streamwrapper.php#streamwrapper.prop...It looks like it's been there for a _long_ time (as in, added in PHP 5 days, according to the wayback machine http://web.archive.org/web/20150814000527/http://php.net/manual/en/class... ), and is only being exposed now with the bump to PHP 8.2 being more strict with dynamic properties?
That said, might make more sense to just define the:
public $context;
bit, instead of allowing any arbitrary
__set()
; though, on second though, we subclassTwistor\FlysystemStreamWrapper
, which would have the same issue?: https://github.com/twistor/flysystem-stream-wrapper/issues/27I threw together https://github.com/twistor/flysystem-stream-wrapper/pull/28 to get try to get it fixed upstream.
- π³πΏNew Zealand Gold 20 minutes in the future
Thanks for this @adam-vessey.
The PR is not merged at the point of this post, so for others that land here, I resolved this by adding twistor/flysystem-stream-wrapper via composer and applying the patch on PR-28 via cweagans/composer-patches.
If this is not yet merged in please comment on the PR if it worked for you.
- πΊπΈUnited States Kasey_MK
Thanks for this solution, which did work to remove the error message we were getting with Flysystem as used by search_api_attachments in our case. I haven't needed twistor/flysystem-stream-wrapper before now, so I'm thinking there must be another solution? I don't know how to account for all the different modules that might interact with Flysystem (but that aren't necessarily designed to do so specifically), but in my admitted ignorance it seems like finding a fix here would be preferred.
In any case, thanks for pointing to twistor/flysystem-stream-wrapper and the patch that adds a public $context property to the stream wrapper, as that does seem to solve the immediate problem.
- First commit to issue fork.
- π¬π§United Kingdom Eli-T Manchester
I'm reopening this because I think we need to take a pragmatic approach here.
Without adding $context to the FlysystemBridge class, we will continue to fill our logs up with PHP warnings on PHP 8.2 and later.
As @adam-vessey says in #6, the best place to fix this is upstream in the twistor/FlysystemStreamWrapper. However, the PR raised on that project has not had any response from the maintainers, and has no commits since 2019. I think it's wise to proceed on the assumption that will never be merged.
I appreciate we can add twistor/flysystem-stream-wrapper as an explicit package and then patch as outlined by @gold in #7 but that has the drawback that if flysystem is removed from a project later, twistor/flysystem-stream-wrapper has to be manually removed, which could be missed.
The argument to patch upstream is moot if that patch will never be accepted upstream.
Therefore I've opened a pull request to to add $context to this module's FlysystemBridge class. Note this is a different solution to the patch in #2, for the reasons discussed in #6.
- Merge request !58#3387094: add $context to FlySystemBridge as required for stream wrappers in... β (Open) created by Eli-T