xref: /PHP-8.3/ext/dom/tests/bug76285.phpt (revision bd9f4fa6)
1--TEST--
2Bug #76285 DOMDocument::formatOutput attribute sometimes ignored
3--EXTENSIONS--
4dom
5--SKIPIF--
6<?php if (!defined("LIBXML_HTML_NOIMPLIED")) die("skip libxml2 2.7.7 required"); ?>
7--FILE--
8<?php
9
10$dom = new DOMDocument();
11$dom->formatOutput = false;
12$html = '<div><div><a>test</a></div><div><a>test2</a></div></div>';
13$dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
14$rootNode = $dom->documentElement;
15var_dump($dom->saveHTML($rootNode));
16var_dump($dom->saveHTML());
17
18?>
19--EXPECT--
20string(56) "<div><div><a>test</a></div><div><a>test2</a></div></div>"
21string(57) "<div><div><a>test</a></div><div><a>test2</a></div></div>
22"
23