When I accidentally left 'all:' and '.settings:' uncommented in
settings.yml with no uncommented properties beneath it; after some
time searching and cursing, I found all the symfony default values
from settins.yml were lost.

Turns out that the '.settings:' element was null and that
arrayDeepMerge always takes the 2nd element's value if one is null.
265                 else if ($isKey0 && $isKey1)
266                 {
267                   $args[2][$key] = $args[1][$key];
268                 }

The default values are kept if I comment out '.settings:' and keep
'all:' uncommented. Which is inconsistent behaviour caused by the
explicit setting of array() by flattenConfiguration() in
sfYamlConfigHandler.

So currently:
$t->is(
  sfToolkit::arrayDeepMerge(array('all' => array('settings'=>array
('a'=>'aa'))), array('all' => array('settings'=>null))),
  array('all' => array('settings'=>null)),
  '::arrayDeepMerge() replaces array with NULL'
);

However, in this case, logic would suggest that the default values
should remain:
$t->is(
  sfToolkit::arrayDeepMerge(array('all' => array('settings'=>array
('a'=>'aa'))), array('all' => array('settings'=>null))),
  array('all' => array('settings'=>array('a'=>'aa'))),
  '::arrayDeepMerge() merges NULL with array'
);

There are a few other tickets (2091, 5082, 6800) that touch the
confusion of merging arrays using arrayDeepMerge, so I'm not sure what
the exact functionality of this method is.

Given the importance of this method with the cascading setup of the
yml system in symfony, better clarity is helpfull, as is better test
coverage.

Is this a bug?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to