1--TEST--
2DOMDocument::saveXML(): XML_SAVE_NO_DECL
3--EXTENSIONS--
4dom
5--SKIPIF--
6<?php
7if (getenv('SKIP_ASAN') && LIBXML_VERSION < 20911) die('xleak leaks under libxml2 versions older than 2.9.11');
8?>
9--FILE--
10<?php
11$doc = new DOMDocument();
12$doc->loadXML('<root>é</root>');
13
14echo $doc->saveXML(options: 0);
15echo $doc->saveXML(options: LIBXML_NOXMLDECL);
16// Explicit encoding test, to ensure no encoding declaration.
17$doc->encoding = "UTF-8";
18echo $doc->saveXML(options: LIBXML_NOXMLDECL);
19
20// Edge case
21$doc = new DOMDocument();
22var_dump($doc->saveXML(options: LIBXML_NOXMLDECL));
23?>
24--EXPECT--
25<?xml version="1.0"?>
26<root>&#xE9;</root>
27<root>&#xE9;</root>
28<root>é</root>
29string(0) ""
30