Re: [CakePHP : The Rapid Development Framework for PHP] #6538: [Test] Wrong serialization of array with XmlHelper::serialize()
#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 chihchun): This issue should be reopened. -- Ticket URL: https://trac.cakephp.org/ticket/6538#comment:3 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 -~--~~~~--~~--~--~---
Re: [CakePHP : The Rapid Development Framework for PHP] #6538: [Test] Wrong serialization of array with XmlHelper::serialize()
#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 chihchun): The [8264] create another issue, which keeps _name_ tag in the serialized xml string. {{{ From 75e55ea45e84f0f32abff180412fcf7b14d10ceb Mon Sep 17 00:00:00 2001 From: Rex Tsai chihc...@kalug.linux.org.tw Date: Thu, 15 Oct 2009 15:39:04 +0800 Subject: [PATCH] clean _name_ field --- cake/libs/xml.php |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cake/libs/xml.php b/cake/libs/xml.php index be7e976..daeccfa 100644 --- a/cake/libs/xml.php +++ b/cake/libs/xml.php @@ -241,7 +241,7 @@ class XmlNode extends Object { } $n = $name; - if (!empty($chldObjs['_name_'])) { + if (isset($chldObjs['_name_'])) { $n = null; unset($chldObjs['_name_']); } -- 1.5.6.5 }}} -- Ticket URL: https://trac.cakephp.org/ticket/6538#comment:4 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 -~--~~~~--~~--~--~---
Re: [CakePHP : The Rapid Development Framework for PHP] #6538: [Test] Wrong serialization of array with XmlHelper::serialize()
#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 id151/id ... /location /locations locations location id134/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 -~--~~~~--~~--~--~---
[CakePHP : The Rapid Development Framework for PHP] #6538: [Test] Wrong serialization of array with XmlHelper::serialize()
#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 id1/id /status /statuses statuses status id2/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 = 'statusesstatusid1/id/statusstatusid2/id/status/statuses'; + $this-assertIdentical($result, $expected); + + $data = array( 'Pages' = array('id' = 2, 'url' = 'http://www.url.com/rb/153/?id=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 -~--~~~~--~~--~--~---