/usr/share/php/test/XML_Parser/tests/002.phpt is in php-xml-parser 1.3.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | --TEST--
XML Parser: parse from file
--SKIPIF--
<?php if (!extension_loaded("xml")) echo 'skip'; ?>
--FILE--
<?php // -*- C++ -*-
//
// Test for: XML/Parser.php
// Parts tested: - parser creation
// - some handlers
// - parse from file
//
chdir (dirname(__FILE__));
if (file_exists('../Parser.php')) {
require_once "../Parser.php";
} else {
require_once "XML/Parser.php";
}
class __TestParser2 extends XML_Parser {
function __TestParser2() {
$this->XML_Parser();
}
function startHandler($xp, $element, $attribs) {
print "<$element";
reset($attribs);
while (list($key, $val) = each($attribs)) {
$enc = htmlentities($val);
print " $key=\"$enc\"";
}
print ">";
}
function endHandler($xp, $element) {
print "</$element>\n";
}
function cdataHandler($xp, $cdata) {
print "<![CDATA[$cdata]]>";
}
function defaultHandler($xp, $cdata) {
}
}
print "new __TestParser2 ";
var_dump(strtolower(get_class($o = new __TestParser2())));
print "setInputFile ";
print is_resource($o->setInputFile("test2.xml"))."\n";
print "parse ";
var_dump($o->parse());
?>
--EXPECT--
new __TestParser2 string(13) "__testparser2"
setInputFile 1
parse <ROOT><![CDATA[foo]]></ROOT>
bool(true)
|