mirror of
https://github.com/php/php-src.git
synced 2026-10-29 02:07:35 +08:00
32 lines
574 B
PHP
32 lines
574 B
PHP
--TEST--
|
|
XMLReader: libxml2 XML Reader, string data
|
|
--EXTENSIONS--
|
|
xmlreader
|
|
--FILE--
|
|
<?php
|
|
|
|
$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
|
|
<books></books>';
|
|
|
|
$reader = new XMLReader();
|
|
$reader->XML($xmlstring);
|
|
|
|
// Only go through
|
|
while ($reader->read()) {
|
|
echo $reader->name."\n";
|
|
}
|
|
$xmlstring = '';
|
|
$reader = new XMLReader();
|
|
|
|
try {
|
|
$reader->XML($xmlstring);
|
|
} catch (Throwable $exception) {
|
|
echo $exception::class, ': ', $exception->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
books
|
|
books
|
|
ValueError: XMLReader::XML(): Argument #1 ($source) must not be empty
|