Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
--TEST--
2
XML Serializer - Bug #9799:  attributesArray is poorly named
3
--FILE--
4
<?php
5
require_once 'XML/Serializer.php';
6
 
7
/*
8
 * bug submitter uses a key of '-'
9
 * for both attributeArray and contentName...
10
 * these must not be the same...
11
 * also, attributeArray was set to array('-')
12
 * when both attributeArray and contentName
13
 * must be strings...
14
 * those two problems caused the issues on
15
 * this bug report
16
 *
17
 * the code below shows the proper use
18
 * of both attributeArray and contentName,
19
 * even though the attributeArray value is
20
 * not actually used in the $color array
21
 */
22
$color = array(
23
    'f'=>array(
24
        array('id'=>'blue', '-' => 'red'),
25
        array('id'=>'qqq',  '-' => 'green')
26
    )
27
);
28
$options = array(
29
    'addDecl' => true,
30
    'rootName'=>'truecolor',
31
    'indent'=>'   ',
32
    'mode'=>'simplexml',
33
    'scalarAsAttributes'=>array('f'=>array('id')),
34
    'attributesArray'=>'+',
35
    'contentName'=>'-',
36
);
37
 
38
$s = new XML_Serializer($options);
39
$status = $s->serialize($color);
40
echo $s->getSerializedData();
41
?>
42
 
43
--EXPECT--
44
<?xml version="1.0"?>
45
<truecolor>
46
   <f id="blue">red</f>
47
   <f id="qqq">green</f>
48
</truecolor>