1--TEST-- 2XMLReader: libxml2 XML Reader, string data 3--EXTENSIONS-- 4xmlreader 5--FILE-- 6<?php 7 8$xmlstring = '<?xml version="1.0" encoding="UTF-8"?> 9<books></books>'; 10 11$reader = new XMLReader(); 12$reader->XML($xmlstring); 13 14// Only go through 15while ($reader->read()) { 16 echo $reader->name."\n"; 17} 18$xmlstring = ''; 19$reader = new XMLReader(); 20 21try { 22 $reader->XML($xmlstring); 23} catch (ValueError $exception) { 24 echo $exception->getMessage() . "\n"; 25} 26 27?> 28--EXPECT-- 29books 30books 31XMLReader::XML(): Argument #1 ($source) must not be empty 32