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()