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

Request #8196 createTagFromArray sort toggle
Submitted: 2006-07-12 21:06 UTC
From: jhart at onyxraven dot com Assigned: schst
Status: Closed Package: XML_Util (version 1.1.1)
PHP Version: 4.4.2 OS: FreeBSD
Roadmaps: (Not assigned)    
Subscription  


 [2006-07-12 21:06 UTC] jhart at onyxraven dot com (Justin Hart)
Description: ------------ Looking through CVS and the downloaded Stable source, it looks like createTagFromArray always sets the sort flag for the attributesToString method. This, and other sorting, should be able to be toggled from the method call. (I've tracked this back from how XML_Serializer uses Util, tracking down where the sort is happening) This is not a critical bug or anything, I just was suprised that though other options like multiline were able to be configured on the FromArray method, that sorting was not. Test script: --------------- include_once 'XML/Util.php'; $tag = array( 'qname' => 'tag', 'attributes' => array( 'c' => 'one', 'b' => 'two', 'a' => 'three', ), ); //assume second parameter is sort flag (as it is in attributesToString $xmltag = XML_Util::createTagFromArray($tag, false); print_r($xmltag); Expected result: ---------------- <tag c="one" b="two" a="three" /> Actual result: -------------- //second sort flag isn't currently implemented <tag a="three" b="two" c="one" />

Comments

 [2006-12-01 17:16 UTC] schst (Stephan Schmidt)
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_Util