xref: /PHP-7.4/ext/xmlreader/tests/002.phpt (revision 26dfce7f)
1--TEST--
2XMLReader: libxml2 XML Reader, file data
3--SKIPIF--
4<?php if (!extension_loaded("xmlreader")) print "skip"; ?>
5--FILE--
6<?php
7$filename = __DIR__ . '/_002.xml';
8$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
9<books></books>';
10file_put_contents($filename, $xmlstring);
11
12$reader = new XMLReader();
13if ($reader->open('')) exit();
14
15$reader = new XMLReader();
16if (!$reader->open($filename)) {
17	$reader->close();
18	exit();
19}
20
21// Only go through
22while ($reader->read()) {
23	echo $reader->name."\n";
24}
25$reader->close();
26unlink($filename);
27touch($filename);
28$reader = new XMLReader();
29$reader->open($filename);
30$reader->close();
31unlink($filename);
32
33?>
34===DONE===
35--EXPECTF--
36Warning: XMLReader::open(): Empty string supplied as input in %s on line %d
37books
38books
39===DONE===
40