|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43514 writelement warning
Submitted: 2007-12-06 10:22 UTC Modified: 2007-12-06 12:28 UTC
From: stem at chalmers dot se Assigned:
Status: Not a bug Package: XML Writer
PHP Version: 5.2.5 OS: Vista 32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: stem at chalmers dot se
New email:
PHP Version: OS:


 [2007-12-06 10:22 UTC] stem at chalmers dot se
issues a warning when passing an array value as "The element name"

Reproduce code:
    $test = array('foo','bar');
    $testarr = array('foo' => array('1','2','3'),'bar' => array('1','2','3'));    
    $titles = array('item_1', 'item_2');
    header('Content-Type: text/xml; charset=iso-8859-1');
    $xml = new xmlWriter();
    $xml->setindentstring('  ');
    $xml->startElement ('root');          
    for($i=0;$i<count($test);$i++) {                     
        $xml->writeElement ('title', $test[$i]);
        $xml->startElement ('data');
        for($j=0;$j<count($testarr[$test[$i]]);$j++) {
            $xml->writeElement ($titles[$j], 'test');    
    print $xml->outputMemory(true); 

Expected result:
No warning.

Actual result:
<b>Warning</b>:  XMLWriter::writeElement() [<a href='function.XMLWriter-writeElement'>function.XMLWriter-writeElement</a>]: Invalid Element Name in <b>D:\devel\bug\index.php</b> on line <b>18</b>

However the xmldata is printed correctley if the source is checked.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-06 12:28 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

If you actually looked at the notices being generated you would see your script is buggy and you are passing bad values to writeElement
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 08:01:28 2024 UTC