1--TEST--
2DOMDocument::saveHTMLFile() should format output on demand
3--CREDITS--
4Knut Urdalen <knut@php.net>
5#PHPTestFest2009 Norway 2009-06-09 \o/
6--EXTENSIONS--
7dom
8--SKIPIF--
9<?php
10if (LIBXML_VERSION >= 21300) die("skip see https://gitlab.gnome.org/GNOME/libxml2/-/issues/756");
11?>
12--FILE--
13<?php
14$filename = __DIR__."/DOMDocument_saveHTMLFile_formatOutput.html";
15$doc = new DOMDocument('1.0');
16$doc->formatOutput = true;
17$root = $doc->createElement('html');
18$root = $doc->appendChild($root);
19$head = $doc->createElement('head');
20$head = $root->appendChild($head);
21$title = $doc->createElement('title');
22$title = $head->appendChild($title);
23$text = $doc->createTextNode('This is the title');
24$text = $title->appendChild($text);
25$bytes = $doc->saveHTMLFile($filename);
26var_dump($bytes);
27echo file_get_contents($filename);
28unlink($filename);
29?>
30--EXPECT--
31int(129)
32<html><head>
33<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
34<title>This is the title</title>
35</head></html>
36