xref: /PHP-7.3/ext/dom/tests/bug80268.phpt (revision 6d2bc725)
1--TEST--
2Bug #80268 (loadHTML() truncates at NUL bytes)
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7$doc = new DOMDocument;
8$doc->loadHTML("<p>foo\0bar</p>");
9$html = $doc->saveHTML();
10var_dump(strpos($html, '<p>foo</p>') !== false);
11
12file_put_contents(__DIR__ . '/80268.html', "<p>foo\0bar</p>");
13$doc = new DOMDocument;
14$doc->loadHTMLFile(__DIR__ . '/80268.html');
15$html = $doc->saveHTML();
16var_dump(strpos($html, '<p>foo</p>') !== false);
17?>
18--CLEAN--
19<?php
20unlink(__DIR__ . '/80268.html');
21?>
22--EXPECT--
23bool(true)
24bool(true)
25