@@ -115,12 +115,13 @@ public function parse($input, string $contextUri = null, string &$rootElementNam
115115 // Unfortunately the XMLReader doesn't support streams. When it
116116 // does, we can optimize this.
117117 $ input = (string ) stream_get_contents ($ input );
118+ }
118119
119- // If input is an empty string, then its safe to throw exception
120- if ('' === $ input ) {
121- throw new ParseException ('The input element to parse is empty. Do not attempt to parse ' );
122- }
120+ // If input is empty, then its safe to throw exception
121+ if (empty ($ input )) {
122+ throw new ParseException ('The input element to parse is empty. Do not attempt to parse ' );
123123 }
124+
124125 $ r = $ this ->getReader ();
125126 $ r ->contextUri = $ contextUri ;
126127 $ r ->XML ($ input , null , $ this ->options );
@@ -158,12 +159,13 @@ public function expect($rootElementName, $input, string $contextUri = null)
158159 // Unfortunately the XMLReader doesn't support streams. When it
159160 // does, we can optimize this.
160161 $ input = (string ) stream_get_contents ($ input );
162+ }
161163
162- // If input is empty string, then its safe to throw exception
163- if ('' === $ input ) {
164- throw new ParseException ('The input element to parse is empty. Do not attempt to parse ' );
165- }
164+ // If input is empty, then its safe to throw exception
165+ if (empty ($ input )) {
166+ throw new ParseException ('The input element to parse is empty. Do not attempt to parse ' );
166167 }
168+
167169 $ r = $ this ->getReader ();
168170 $ r ->contextUri = $ contextUri ;
169171 $ r ->XML ($ input , null , $ this ->options );
0 commit comments