|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-12-06 12:28 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
Description: ------------ issues a warning when passing an array value as "The element name" Reproduce code: --------------- <?php $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->openMemory(); $xml->setindent(true); $xml->setindentstring(' '); $xml->startDocument('1.0','iso-8859-1'); $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'); } $xml->endElement(); } $xml->endElement(); 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.