Skip to content

Response can sometimes emits data twice with incompatible arguments #65

@mmelvin0

Description

@mmelvin0

I'm struggling to reproduce this and I can't anymore, but it's fairly clear in the code this is possible. There are two places where the data event for a Response can be triggered.

In Response::handleData the arguments are string, Response.

In Request::handleData the arguments are Psr\Http\Message\StreamInterface, Response.

The latter seems to be correct, happens all the time, and what I want to incrementally read from the stream, so I just wrap my own handleData logic in $stream instanceof StreamInterface but that feels smelly.

The thing I can't reproduce is when Response::handleData gets called. It was happening to me every single time the responding server threw a fatal PHP error, now I can't make it happen. Also of interesting note it was returning only part of the PHP error text, although the stream itself yielded the entire text.

Also of note this is with v0.4.10 (I'll update to the latest) but the code is identical in your master branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy