Bug #74494 [Opn->Nab]: DOMDocument::saveXML() LIBXML_NOEMPTYTAG option is ignored
Edit report at https://bugs.php.net/bug.php?id=74494&edit=1
ID: 74494
Updated by: requinix@php.net
Reported by: mfburdett at gmail dot com
Summary: DOMDocument::saveXML() LIBXML_NOEMPTYTAG option is
ignored
-Status: Open
+Status: Not a bug
Type: Bug
Package: DOM XML related
Operating System: FreeBSD
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
LIBXML_NOEMPTYTAG only applies to XML documents. Yours is HTML.
Use ->saveHTML().
Previous Comments:
------------------------------------------------------------------------
[2017-04-24 18:11:06] mfburdett at gmail dot com
Description:
------------
When executing a PHP script using the Apache module, the DOMDocument::saveXML() LIBXML_NOEMPTYTAG
option is ignored - a self-closing tag, e.g. <body /> is created.
When executing the same script on the commandline, the LIBXML_NOEMPTYTAG option is honored.
This could be a bug in how PHP, Apache and LibXML are compiled by FreeBSD ports, rather than a bug
in PHP itself.
Test script:
---------------
<?php
$dom = new \DOMDocument();
$dom->loadHTML('<body></body>');
$node = $dom->getElementsByTagName('body')->item(0);
echo $dom->saveXML($node, LIBXML_NOEMPTYTAG);
Expected result:
----------------
<body></body>
Actual result:
--------------
<body/>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74494&edit=1
Thread (8 messages)