PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » XML » XML_Util » Bug #8196

createTagFromArray sort toggle

Details

Request #8196createTagFromArray sort toggle
Submitted2006-07-12 21:06 UTC
Fromjhart at onyxraven dot com
Assignedschst
StatusClosed
PackageXML_Util
PHP Version4.4.2
OSFreeBSD
Roadmaps(Not assigned)

Comments

[2006-07-12 21:06 UTC] jhart at onyxraven dot com

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" />