Bug #74494 [NEW]: DOMDocument::saveXML() LIBXML_NOEMPTYTAG option is ignored

From: Date: Mon, 24 Apr 2017 18:11:11 +0000
Subject: Bug #74494 [NEW]: DOMDocument::saveXML() LIBXML_NOEMPTYTAG option is ignored
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208755@lists.php.net to get a copy of this message
From:             mfburdett at gmail dot com
Operating system: FreeBSD
PHP version:      7.1.4
Package:          DOM XML related
Bug Type:         Bug
Bug description:DOMDocument::saveXML() LIBXML_NOEMPTYTAG option is ignored

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 bug report at https://bugs.php.net/bug.php?id=74494&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74494&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74494&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74494&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74494&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74494&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74494&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74494&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74494&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74494&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74494&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74494&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74494&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74494&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74494&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74494&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74494&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74494&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74494&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74494&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74494&r=mysqlcfg



Thread (8 messages)

« previous php.bugs (#208755) next »