|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-04-24 18:11 UTC] 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/>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 12:00:01 2025 UTC |
I can also reproduce this bug with an XML document: <?php $dom = new \DOMDocument(); $dom->loadXML('<root><node/></root>'); $node = $dom->getElementsByTagName('node')->item(0); echo $dom->saveXML($node, LIBXML_NOEMPTYTAG); Expected result: <node></node> Actual result: <node/>