Skip to content

[8.45.1] Cloned PendingRequest raises a "($request) must be of type Illuminate\Http\Client\Request, null given" error #37594

@juanparati

Description

@juanparati
  • Laravel Version: 8.45.1
  • PHP Version: 8.x
  • Database Driver & Version:
  • Guzzle version: 7.3.0

Description:

I notice that after to upgrade to 8.45.1 an error is raised when I attempt to perform a request in a cloned PendingRequest instance. I observed that this error is not raised with version 8.44.0.

The error raised is:

TypeError: Illuminate\Http\Client\Events\ResponseReceived::__construct(): Argument #1 ($request) must be of type Illuminate\Http\Client\Request, null given, called in /home/vagrant/foobar/code/vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php on line 989

The error is raised when the method "dispatchResponseReceivedEvent" is called and I observed that "$this->request" is null.

Steps To Reproduce:

  • Upgrade to Laravel 8.45.1
  • Run the following code (for example into Tinker):
$client = \Http::timeout(10);
$newClient = clone $client;
$newClient->get('https://google.com');

I supect that this bug was introduced in 065e130

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions