This is kind of similar to http://drupal.org/node/1089816.
On arrays that are part indexed and part associative, ksort is returning different values back, which is causing false overrides. I know these can be avoided but it would be nice if the Feature showed as DEFAULT.
Example (0 index is throwing ksort for a loop):
$a = array(
'meta_name' => 'description',
0 => 'meta_name',
'test_key' => 'test_val'
);
ksort($a);
/*
Array
(
[test_key] => test_val
[0] => meta_name
[meta_name] => description
)
*/
$b = array(
0 => 'meta_name',
'meta_name' => 'description',
'test_key' => 'test_val'
);
ksort($b);
/*
Array
(
[0] => meta_name
[meta_name] => description
[test_key] => test_val
)
*/
What do you think about adding a sort_flag, i.e.
864 ksort($array);
to
864 ksort($array, SORT_STRING);
This will alter how indexed arrays return back, i.e. 11 before 2, but that shouldn't be an issue as this is just trying to normalize 2 arrays for comparative purposes.
Thanks
Comments
Comment #0.0
mlee11111 commentedAdded code tags.
Comment #0.1
mlee11111 commentedMade easier to read.
Comment #1
mpotter commentedInteresting. I think this is reasonable. Some quick testing doesn't show any side effects so far. Here is an actual patch for review.
Comment #2
mlee11111 commentedSorry I didn't submit a patch file, but that's exactly what I had.
PHP 5.4 has a SORT_NATURAL which would make the sort even nicer, but SORT_STRING does the trick for now.
Seems to bring my features into full synchronization with no noticeable effects.
Thanks for the quick response.
Comment #3
alexander allen commentedTested, works. All the false overrides I had due to 'meta_name' => 'description' are now gone. This is great, thank you very much!
Comment #4
alexander allen commentedAccidentally changed status.
Comment #5
roderikAlready in http://drupalcode.org/project/features.git/commit/a48b0a4, I see.
Comment #6.0
(not verified) commentedGrammer fix.