php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63060 Option LIBXML_NOEMPTYTAG is ignored
Submitted: 2012-09-11 09:36 UTC Modified: -
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: maglor at i dot ua Assigned:
Status: Open Package: SimpleXML related
PHP Version: 5.3.16 OS: Windows XP SP3
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-09-11 09:36 UTC] maglor at i dot ua
Description:
------------
Option LIBXML_NOEMPTYTAG is ignored for SimpleXMLElement::__construct() and simplexml_load_string() 

Probably, for simplexml_load_file() also.



Test script:
---------------
<?php 

$xml = new SimpleXMLElement('<?xml version="1.0" encoding="utf-8"?><request><packet></packet></request>', LIBXML_NOEMPTYTAG);
$xml->saveXML();


Expected result:
----------------
<?xml version="1.0" encoding="utf-8"?>
<request><packet></packet></request>

Actual result:
--------------
<?xml version="1.0" encoding="utf-8"?>
<request><packet/></request>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-11 12:12 UTC] reeze dot xia at gmail dot com
Hi maglor,

http://php.net/manual/en/libxml.constants.php


LIBXML_NOEMPTYTAG (integer)
Expand empty tags (e.g. <br/> to <br></br>)
Note:

This option is currently just available in the DOMDocument::save and 
DOMDocument::saveXML functions.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jul 17 06:01:26 2019 UTC