On Aug 13, 4:49 pm, Martin Kreidenweis <[EMAIL PROTECTED]> wrote:
> > When you ask
> > array_merge() to merge these two arrays it overwrites original lhs
> > array elements with same keys of rhs array.

> That's not true.

You're absolutely right, excuse this wording mistake and simply
pretend I said array_merge() meaning sfToolkit::arrayDeepMerge()
because it's exactly how it behaves. The problem code:

          foreach
(array_unique(array_merge(array_keys($args[0]),array_keys($args[1])))
as $key)
          {
            $isKey0 = array_key_exists($key, $args[0]);
            $isKey1 = array_key_exists($key, $args[1]);
            if ($isKey0 && $isKey1 && is_array($args[0][$key]) &&
is_array($args[1][$key]))
            {
              $args[2][$key] = self::arrayDeepMerge($args[0][$key],
$args[1][$key]);
            }
            else if ($isKey0 && $isKey1)
            {
              $args[2][$key] = $args[1][$key];
              ^^^ the problem line. It says "if both keys exist,
overwrite".
            }

Fixing this "numeric vs. string key" bug (by perhaps utilizing
(array_merge_recursive ?) will not solve the original problem because
you still won't be able to completely override the "standard_helpers"
setting, you'll just be able to append to it. The full solution would
involve distinguishing between "user value" arrays and "containment
hierarchy" arrays...


--~--~---------~--~----~------------~-------~--~----~
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