#6538: [Test] Wrong serialization of array with XmlHelper::serialize()
--------------------------+-------------------------------------------------
    Reporter:  dho        |          Type:  Bug    
      Status:  new        |      Priority:  Medium 
   Milestone:  1.2.x.x    |     Component:  Helpers
     Version:  1.2 Final  |      Severity:  Normal 
    Keywords:             |   Php_version:  PHP 5  
Cake_version:  rev. 8263  |  
--------------------------+-------------------------------------------------
 If I put the result of a find all operation in an array to get a structure
 like
 {{{
 Array
 (
     [Statuses] => Array
         (
             [0] => Array
                 (
                     [Status] => Array
                         (
                             [id] => 1
                         )
                 )
             [1] => Array
                 (
                     [Status] => Array
                         (
                             [id] => 2
                         )
                 )
         )
 )
 }}}
 and I serialize this array with {{{$xml->serialize($data, array('format'
 => 'tags'));}}}, then I get the following output:
 {{{
 <statuses>
   <statuses>
     <status>
       <id>1</id>
     </status>
   </statuses>
   <statuses>
     <status>
       <id>2</id>
     </status>
   </statuses>
 </statuses>
 }}}
 See also the test case:
 {{{
 Index: xml.test.php
 ===================================================================
 --- xml.test.php        (revision 8263)
 +++ xml.test.php        (working copy)
 @@ -204,6 +204,13 @@
                 $this->assertIdentical($result, $expected);

                 $data = array(
 +                       'Statuses' => array(array('Status' => array('id'
 => 1)), array('Status' => array('id' => 2)))
 +               );
 +               $result = $this->Xml->serialize($data, array('format' =>
 'tags'));
 +               $expected =
 '<statuses><status><id>1</id></status><status><id>2</id></status></statuses>';
 +               $this->assertIdentical($result, $expected);
 +
 +               $data = array(
                         'Pages' => array('id' => 2, 'url' =>
 'http://www.url.com/rb/153/?id=bbbb&t=access')
                 );
                 $result = $this->Xml->serialize($data);

 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6538>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
tickets-cakephp+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to