1--TEST--
2Test flag LIBXML_NO_XXE
3--EXTENSIONS--
4dom
5--SKIPIF--
6<?php
7if (!defined('LIBXML_NO_XXE')) die('skip LIBXML_NO_XXE not available');
8?>
9--FILE--
10<?php
11$xml = <<< XML
12<?xml version='1.0' encoding='utf-8'?>
13<!DOCTYPE set [
14    <!ENTITY foo '<foo>bar</foo>'>
15    <!ENTITY xxe SYSTEM "file:///etc/passwd">
16]>
17<set>&foo;&xxe;</set>
18XML;
19
20$doc = Dom\XMLDocument::createFromString($xml, LIBXML_NOENT | LIBXML_NO_XXE);
21echo $doc->saveXML();
22?>
23--EXPECT--
24<?xml version="1.0" encoding="utf-8"?>
25<!DOCTYPE set [
26<!ENTITY foo "<foo>bar</foo>">
27<!ENTITY xxe SYSTEM "file:///etc/passwd">
28]>
29<set><foo>bar</foo></set>
30