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