Skip to content

Passing a closed resource to Service parse or expect causes error #297

@phil-davis

Description

@phil-davis

Create a resource with fopen(), then fclose() the resource, then pass it to Service parse() or expect()

You get a PHP error:

XMLReader::XML() expects parameter 1 to be string, resource given

This is because a previous check in the code for is_resource() does not do what you might think at first reading.
is_resource($input) only returns true if $input is a resource that is still open. If the resource is closed then it returns false.
So our code is letting a closed resource be passed to Reader XML()

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