svn: /pear2/Pyrus/trunk/src/Pyrus/ChannelFile/ v1.php
[email protected] (Brett Bieber) Wed, 28 Jul 2010 00:01:58 +0000
| Newsgroups | php.pear.cvs,php.pear.core |
|---|---|
| Message-ID | <[email protected]> |
saltybeagle Wed, 28 Jul 2010 00:01:58 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=301627
Log:
When an associative array is passed to construct a new channel object, sort the elements so they're in the order we expect. Fixes tests/ScriptFrontend/Commands/upgradeRegistry.phpt
Changed paths:
U pear2/Pyrus/trunk/src/Pyrus/ChannelFile/v1.php
Modified: pear2/Pyrus/trunk/src/Pyrus/ChannelFile/v1.php
===================================================================
--- pear2/Pyrus/trunk/src/Pyrus/ChannelFile/v1.php 2010-07-27 23:59:16 UTC (rev 301626)
+++ pear2/Pyrus/trunk/src/Pyrus/ChannelFile/v1.php 2010-07-28 00:01:58 UTC (rev 301627)
@@ -97,6 +97,22 @@
if (isset($data['channel'])) {
$this->channelInfo = $data['channel'];
} else {
+ // Sort the array so the elements will pass validation
+ uksort($data, function($el1, $el2) {
+ $order = array('name' => 0,
+ 'suggestedalias' => 1,
+ 'summary' => 2,
+ 'validatepackage' => 3,
+ 'servers' => 4,
+ '_lastmodified' => 5);
+ if (!isset($order[$el1])) {
+ return false;
+ }
+ if (!isset($order[$el2])) {
+ return true;
+ }
+ return $order[$el1] > $order[$el2];
+ });
$this->channelInfo = $data;
}