On Aug 13, 1:42 pm, Alexander Deruwe <[EMAIL PROTECTED]>
wrote:
> On 13 Aug 2007, at 08:20, rihad wrote:
>
> > There's a bug in the way Symfony parses YAML configuration files
> > containing arrays as values. The problem is described in this ticket:
> >http://trac.symfony-project.com/trac/ticket/2091
> > In short: the array_merge PHP primitive that lies in the heart of
> > "configuration cascade" won't let you override an array with a whole
> > new one containing a different number of elements; the arrays will
> > simply be merged. This seems logical but for me personally being
> > unable to override Symfony's standard_helpers configuration setting
> > (among others) is a major bug. What do y'all think?
>
> You can change standard_helpers in an application's settings.yml:
>
> all:
> .settings:
> standard_helpers: [Object, Form, Cache]
>
> Probably most others you are thinking about as well?
>
Let me go a bit deeper into this.
The stock default standard_helpers in %SF_DATA_DIR%/config/
settings.yml contains:
default:
.settings:
standard_helpers: [Partial, Cache, Form]
my %SF_ROOT_DIR%/config/settings.yml (or %SF_APP/config/settings.yml -
no difference) contains:
all:
.settings:
standard_helpers: [Object, Form, Cache]
This indeed results in a PHP array [Object, Form, Cache] and gives you
a warm feeling that everything works. But you should be aware that it
worked by accident, and not because of design. In PHP lingo, the
original standard_helpers array looks like array(0 => 'Partial', 1=>
'Cache', 2 => 'Form'); and the new one like array(0 => 'Object', 1=>
'Form', 2 => 'Cache'); When you ask array_merge() to merge these two
arrays it overwrites original lhs array elements with same keys of rhs
array. Get the idea? Now if you will substitute the overwritten array
with [Cache,Form], or [Form], or just [], and you will get this,
respectively:
[Cache, Form, Form]
or
[Form, Cache, Form]
or
[Partial, Cache, Form] # left intact becase NO elements were
overwritten.
This is indeed a bug, and a bad one. The documentation too is
misleading about this (please see my comment in the end):
http://www.symfony-project.com/book/trunk/18-Performance
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---