flint / tacker

Easy loading of configurations files using Symfony Config. Supports Normalization, Inheritance and a buttload of filetypes.
http://flint.rtfd.org/projects/tacker
MIT License
17 stars 6 forks source link

EnvironmentNormalizer tried to normalize object #8

Closed Ronnie-J closed 8 years ago

Ronnie-J commented 9 years ago

Hi Henrik.

This issue is on version 1.2.1of flint/tacker. I haven't upgraded due to the dependencies for Pimple 1.0 and Silex 1.3

I have a security configuration like this:

security.firewalls:
    secret:
        pattern: "^/something"
        my_login:
            logout_return_path: '/logout/success'
            login_return_path: '/somepath
        users: %security.user_provider.my_login%
        logout:
            logout_path: '/somepath/logout'

users: %security.user_provider.my_login% is picked up fine by the PimpleNormalizer but just after the EnvironmentNormalizer triggers and at this point tries to convert my object into a string which fails of course. Do you know why it would try and parse the object in the EnvironmentNormalizer since it was picked up by the PimpleNormalizer?

If I simply check for objects in the EnvironmentNormalizer and return if so then the code seems to run as expected.

henrikbjorn commented 9 years ago

Hey @Ronnie-J

We had the same problem a few weeks back where i tried to fix this in the master branch, by having the ChainNormalizer ignore everything that is a scalar (6515c47002aef5e9fefda8958d9a23fb23618cbe). This works great for the normalization part, but when Tacker then tries to dump the configuration as a cache it will receive a closure and then php will throw a fit (Cannot serialize a closure).

I am not sure if we can do anything about that, except maybe do a PR against Silex and have it save the service id of the users and call it when it needs it.

Ronnie-J commented 9 years ago

Hi @henrikbjorn.

Yes I do see the problem. It would be nice with that kind of support in the future. :+1:

henrikbjorn commented 8 years ago

This is a Silex problem and it is impossible to dump object without doing hacks (Like the SerializableClosure found in Laravel)