|  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
 [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: Tue Jul 16 02:01:27 2024 UTC