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