Fatal error when instantiating stream using guzzlehttp/psr7 2.x

Created on 19 September 2023, 10 months ago

Problem/Motivation

We are using guzzlehttp/psr7 as a file stream transport handler. When instantiating a new Stream we are supposed to pass the options as an array. We are passing a string, which is causing a fatal error.

In older 1.x versions of the library we were also supposed to pass an options array, but since this parameter was not strictly typed this did not result in a fatal error. Starting with 2.x it does.

Steps to reproduce

  1. Update to guzzlehttp/psr7 2.0.0 or higher.
  2. Load a Rokka file through the stream wrapper (e.g. file_get_contents('rokka://myfile.jpg')).

Result: a fatal type error is thrown:

TypeError: GuzzleHttp\Psr7\Stream::__construct(): Argument #2 ($options) must be of type array, string given, called in modules/contrib/rokka/src/RokkaStreamWrapper.php on line 212

Proposed resolution

Adhere to the API and pass the options as an array.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024