PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » XML » XML_Serializer » Bug #9799

attributesArray is poorly named

Details

Submitted2007-01-10 23:24 UTC
Fromljou1 at yahoo dot com
Assignedashnazg
StatusBogus
PackageXML_Serializer
PHP Version5.1.2
OSwindows xp
Roadmaps(Not assigned)

Comments

[2007-01-10 23:24 UTC] ljou1 at yahoo dot com

Description:
------------
When attributesArray is set to an arry, it cuases php to generate warning.

Warning: Illegal offset type in isset or empty in C:\oscommerce\xampp\php\pear\X
ML\Serializer.php on line 713

Test script:
---------------
<?php
require_once 'XML/Serializer.php';

$color = array('f'=>array(array('id'=>'blue','-'=>'red'),array('id'=>'qqq','-'=>'green')));
$options = array(
'addDecl' => true,
'rootName'=>'truecolor',
'indent'=>' ',
'mode'=>'simplexml',
'scalarAsAttributes'=>array('f'=>array('id')),
'attributesArray'=>array('-'),
'contentName'=>'-'
);

$s = new XML_Serializer($options);
$status = $s->serialize($color);
echo $s->getSerializedData();
?>

Expected result:
----------------
The results is connect expect the warning messages.

Actual result:
--------------
Warning: Illegal offset type in isset or empty in C:\oscommerce\xampp\php\pear\X
ML\Serializer.php on line 713

Warning: Illegal offset type in isset or empty in C:\oscommerce\xampp\php\pear\X
ML\Serializer.php on line 713

Warning: Illegal offset type in isset or empty in C:\oscommerce\xampp\php\pear\X
ML\Serializer.php on line 713

Warning: Illegal offset type in isset or empty in C:\oscommerce\xampp\php\pear\X
ML\Serializer.php on line 713
<?xml version="1.0"?>
<truecolor>
<f id="blue">red</f>
<f id="qqq">green</f>
</truecolor>