Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #3930 serializer is not fully DTD compliant
Submitted: 2005-03-23 14:24 UTC
From: ez at daoldskool dot org Assigned: alan_k
Status: Closed Package: XML_Wddx
PHP Version: 4.3.10 OS: ANY
Roadmaps: (Not assigned)    
Subscription  


 [2005-03-23 14:24 UTC] ez at daoldskool dot org
Description: ------------ serializer is encapsulating array nodes inside a var node without attributes this is double wrong according to wddx official DTD (http://www.openwddx.org/downloads/dtd/wddx_dtd_10.txt) : 1) var nodes should always have an attribute name 2) var nodes are not allowed inside an array this is not a big deal when deserializing wddx streams : both native & PEAR deserializers are smart enough but now i am doing xslt on wddx streams it changes everything ! plus wddx streams encoded with PEAR are not valid --- another slight difference between PEAR & native PHP wddx workaround : native PHP is encapsulating special chars inside a string into a char node while PEAR is encapsulating the whole string into a CDATA section don't know yet how to deal with it, so far i think i can handle it both ways Reproduce code: --------------- proof of concept : http://test.peoplemode.com/__dev/test/test_fat.php with PEAR::XML_Wddx http://test.peoplemode.com/__dev/home_news.php?fat&native with native PHP wddx functions: http://test.peoplemode.com/__dev/home_news.php?fat Expected result: ---------------- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <wddxPacket version="1.0"> <header /> <data> <struct> <var name="NEWS"> <array length="4"> <string> <![CDATA[ PEOPLEMODE CE N&apos;EST PAS UN SITE PEOPLE, MAIS UNE VERITABLE BOUTIQUE MODE SUR INTERNET POUR VOUS CREER UN LOOK BRANCHE ! ]]> </string> <string> <![CDATA[ SUR PEOPLEMODE LA STAR DES BOUTIQUE, VOUS TROUVEREZ LES MEMES MARQUES ET MEMES PRODUITS QUE CEUX PORTES PAR VOS STARS PREFEREES ]]> </string> <string> <![CDATA[ VOUS POUVEZ AUSSI NOUS DEMANDER DE VOUS RECHERCHER UN ARTICLE PRECIS VU RECEMMENT SUR VOTRE STAR PREFEREE. ]]> </string> <string> <![CDATA[ ALORS HABILLEZ-VOUS STAR ET PROFITEZ DE TOUS NOS SERVICES EN VOUS ENREGISTRANT DES MAINTENANT ! ]]> </string> </array> </var> </struct> </data> </wddxPacket> Actual result: -------------- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <wddxPacket version="1.0"> <header /> <data> <struct> <var name="NEWS"> <array length="4"> <var> <string> <![CDATA[ PEOPLEMODE CE N&apos;EST PAS UN SITE PEOPLE, MAIS UNE VERITABLE BOUTIQUE MODE SUR INTERNET POUR VOUS CREER UN LOOK BRANCHE ! ]]> </string> </var> <var> <string> <![CDATA[ SUR PEOPLEMODE LA STAR DES BOUTIQUE, VOUS TROUVEREZ LES MEMES MARQUES ET MEMES PRODUITS QUE CEUX PORTES PAR VOS STARS PREFEREES ]]> </string> </var> <var> <string> <![CDATA[ VOUS POUVEZ AUSSI NOUS DEMANDER DE VOUS RECHERCHER UN ARTICLE PRECIS VU RECEMMENT SUR VOTRE STAR PREFEREE. ]]> </string> </var> <var> <string> <![CDATA[ ALORS HABILLEZ-VOUS STAR ET PROFITEZ DE TOUS NOS SERVICES EN VOUS ENREGISTRANT DES MAINTENANT ! ]]> </string> </var> </array> </var> </struct> </data> </wddxPacket>

Comments

 [2005-03-23 14:46 UTC] ez at daoldskool dot org
147c147 < $ret .= $is_struct ? sprintf("<var name='%s'>",$k) : ''; --- > $ret .= $is_struct ? sprintf("<var name='%s'>",$k) : '<var>'; 152c152 < $ret .= $is_struct ? "</var>\n" : "\n"; --- > $ret .= "</var>\n";
 [2005-03-24 10:03 UTC] alan_k
The cdata stuff was deliberate, it was a PITA to do all the replacement with all the wierd characters that the php version does.. The var one does need fixing though... -
 [2005-03-24 23:44 UTC] ez at daoldskool dot org
Alan, thanx for your quick answer i do agree about the cdata stuff and i submited a patch for the var thing (but i put it upside down ! sorry) maybe u shoul also take a closer look to the endHandler method where line 329 is not that obvious anymore ?
 [2005-03-30 02:48 UTC] alan_k
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/XML_Wddx