From:             stem at chalmers dot se
Operating system: Vista 32
PHP version:      5.2.5
PHP Bug Type:     XML Writer
Bug description:  writelement warning

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.

-- 
Edit bug report at http://bugs.php.net/?id=43514&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43514&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43514&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43514&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43514&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43514&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43514&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43514&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43514&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43514&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43514&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43514&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43514&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43514&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43514&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43514&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43514&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43514&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43514&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43514&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43514&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43514&r=mysqlcfg

Reply via email to