#6538: [Test] Wrong serialization of array with XmlHelper::serialize()
--------------------------+-------------------------------------------------
    Reporter:  dho        |         Owner:           
        Type:  Bug        |        Status:  closed   
    Priority:  Medium     |     Milestone:  1.2.x.x  
   Component:  Helpers    |       Version:  1.2 Final
    Severity:  Normal     |    Resolution:  fixed    
    Keywords:             |   Php_version:  PHP 5    
Cake_version:  rev. 8263  |  
--------------------------+-------------------------------------------------
Comment (by tobi_one):

 This fixes the XML output of a find all operation, but once you do custom
 array data the XML is broken again. E.g. if you wrap the find all result
 in another array to add some additional data;

 {{{

 [output] => Array
         (
             [Vouchers] => Array
                 (
                     [0] => Array
                     (
                         [Voucher] => Array
                             (
                                 [id] => 1
                                 [title] => something
                             )
                     )
                     [1] => Array
                     (
                     ...
                     )
                 )

             [my_pixel_x] => -2950
             [my_pixel_y] => 10123
             [zoom] => 8
             [latitude] => 48.5
             [longitude] => 16.2
         )
 }}}

 then the Vouchers will be wrapped multiple times as before the fix:

 {{{
 <output>
     <vouchers>
         <voucher>
             <id></id>
             <title></title>
         </voucher>
     </vouchers>
     <vouchers>
          <voucher>
          ....
          </voucher>
     </vouchers>
     <my_pixel_x>-2950</my_pixel_x>
     ...
 </output>

 }}}

 it also does not work with multiple nested arrays e.g.

 {{{
 [Vouchers] => Array
         (
             [0] => Array
                 (
                     [Voucher] => Array
                         (
                             [id] => 1
                             [title] => something
                             [Locations] => Array
                                 (
                                     [0] => Array
                                         (
                                             [Location] => Array
                                                 (
                                                     [id] => 151
                                                     [lat] => 48.563301
                                                     [lng] => 16.079201
                                                 )

                                         )

                                     [1] => Array
                                         (
                                             [Location] => Array
                                                 (
                                                     [id] => 134
                                                     [lat] => 48.289799
                                                     [lng] => 16.383801
                                                 )

                                         )

                                     [2] => Array
                                         (
                                             [Location] => Array
                                                 (
                                                     [id] => 129
                                                     [lat] => 48.297100
                                                     [lng] => 16.419800
                                                 )

                                         )

                                 )

                         )

                 )
        )

 }}}

 there again, locations will be wrapped multiple times in the XML:

 {{{
 ...
 <locations>
     <location>
         <id>151</id>
         ...
     </location>
 </locations>
 <locations>
     <location>
         <id>134</id>
         ...
     </location>
 </location>
 ...
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6538#comment:2>
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