[php-src] Issue #13631: `HTMLDocument::saveHTML` returns `$node`’s inner HTML rather than outer HTML

From: Date: Fri, 08 Mar 2024 08:31:20 +0000
Subject: [php-src] Issue #13631: `HTMLDocument::saveHTML` returns `$node`’s inner HTML rather than outer HTML
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246536@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13631 Author: MatTheCat ### Description The following code: ```php <?php $doc = \DOM\HTMLDocument::createFromString('<!DOCTYPE html><html><body><h1><p>Foo</p></h1></body></html>'); var_dump($doc->saveHTML($doc->documentElement)); ``` Resulted in this output: ``` string(45) "<head></head><body><h1><p>Foo</p></h1></body>" ``` But I expected this output instead: ``` string(58) "<html><head></head><body><h1><p>Foo</p></h1></body></html>" ``` The documentation isn’t clear on this subject but every other saveHTML method returns the $node parameter’s outer HTML, so I guess HTMLDocument::saveHTML is at fault. ### PHP Version PHP 8.4.0-dev ### Operating System Arch Linux

« previous php.bugs (#246536) next »