Skip to content

Commit

Permalink
check if parser input is not a string
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Sep 6, 2024
1 parent b04f29d commit bfcbec1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function getWriter(): Writer
*/
public function parse($input, ?string $contextUri = null, ?string &$rootElementName = null)
{
if (is_resource($input)) {
if (!is_string($input)) {
// Unfortunately the XMLReader doesn't support streams. When it
// does, we can optimize this.
$input = (string) stream_get_contents($input);
Expand Down Expand Up @@ -153,7 +153,7 @@ public function parse($input, ?string $contextUri = null, ?string &$rootElementN
*/
public function expect($rootElementName, $input, ?string $contextUri = null)
{
if (is_resource($input)) {
if (!is_string($input)) {
// Unfortunately the XMLReader doesn't support streams. When it
// does, we can optimize this.
$input = (string) stream_get_contents($input);
Expand Down

0 comments on commit bfcbec1

Please sign in to comment.