public function testURLInvocation_doctype_setParserProperty_SUBST_ENTITIES() { // reset the counter $r = file_get_contents("http://127.0.0.1:5000/reset"); $r = file_get_contents("http://127.0.0.1:5000/getCounter"); $r = preg_replace('/\\s+/', '', $r); $this->assertEquals("0", $r); $xml = new XMLReader(); $xml->open("../../xml_files_windows/ssrf/url_invocation_doctype.xml"); $xml->setParserProperty(XMLReader::SUBST_ENTITIES, true); $this->assertTrue($xml->getParserProperty(XMLReader::SUBST_ENTITIES)); while ($xml->read()) { if ($xml->nodeType == XMLReader::ELEMENT && $xml->name == 'data') { $node = $xml->name; $content = $xml->readString(); } } $r = file_get_contents("http://127.0.0.1:5000/getCounter"); $r = preg_replace('/\\s+/', '', $r); $this->assertEquals("0", $r); }
<?php /* $Id$ */ $xmlstring = '<?xml version="1.0" encoding="UTF-8"?> <books></books>'; $reader = new XMLReader(); $reader->XML($xmlstring); $a = $reader->setParserProperty(XMLReader::LOADDTD, false); $b = $reader->getParserProperty(XMLReader::LOADDTD); if (!$a && !$b) { echo "ok\n"; } $a = $reader->setParserProperty(XMLReader::SUBST_ENTITIES, true); $b = $reader->getParserProperty(XMLReader::SUBST_ENTITIES); if ($a && $b) { echo "ok\n"; } // Only go through while ($reader->read()) { } $reader->close(); ?> ===DONE===
public function getParserProperty($property) { return parent::getParserProperty($property); }