|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43754 XMLWriter::fullEndElement produces wrong indentation
Submitted: 2008-01-04 21:20 UTC Modified: 2008-01-09 09:47 UTC
From: karel dot smutny at gmail dot com Assigned:
Status: Closed Package: XML Writer
PHP Version: 5.2.5 OS: Windows XP SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: karel dot smutny at gmail dot com
New email:
PHP Version: OS:


 [2008-01-04 21:20 UTC] karel dot smutny at gmail dot com
fullEndElement() procedure produces wrong indentation when called setIndent(true). There is no new line and indentation before tag  following another end tag produced by fullEndElement().

Reproduce code:
  $xml = new XMLWriter();
  $xml->writeAttribute('id', 'all');
  $xml->writeAttribute('id', 'header');
  $xml->writeAttribute('id', 'content');
  $xml->writeAttribute('id', 'footer');
  echo $xml->outputMemory();

Expected result:
 <div id="all">
  <div id="header"></div>  
  <div id="content"></div>  
  <div id="footer"></div>

Actual result:
 <div id="all">
  <div id="header"></div>  <div id="content"></div>  <div id="footer"></div></div></body>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-08 21:13 UTC]
AFAIK, this is a bug in Libxml. Seeing the source in
in xmlTextWriterFullEndElement() is missing:

    if (writer->indent) {
        count = xmlOutputBufferWriteString(writer->out, "\n");
        sum += count;

That is founded in xmlTextWriterEndElement() (called from endElement() in PHP extension), and works fine. :)
 [2008-01-09 09:47 UTC]
I reported this bug, and already fixed in SVN (libxml).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 21:01:28 2024 UTC