craue / CraueConfigBundle

Database-stored settings made available via a service for your Symfony project.
MIT License
173 stars 35 forks source link

avoid deprecation notices with Symfony 2.8 #22

Closed craue closed 9 years ago

craue commented 9 years ago

This PR is meant for trying to avoid as many deprecation notices as possible introduced by symfony/symfony#15079.

I'm pretty sure I've updated all relevant code to not use deprecated functionality while keeping BC. The remaining notices seem to be triggered by Symfony itself.

Travis log:

craue commented 9 years ago

I found out that removing the getName method from built-in form types (at least for CollectionType, HiddenType, and TextType as these are used by the bundle's tests -- removing it from FormType leads to an exception) helps in reducing the remaining notices, but this method is going to be removed only in Symfony 3.0. And the notice regarding the scope is obviously trigged by AsseticBundle. So it looks like there's nothing more I can actually do about getting rid of all notices.

craue commented 9 years ago

@stof, do you see why the tests exit with a fatal error on Symfony 3.0-dev, btw?

stof commented 9 years ago

this looks like there is a Twig_Node_Expression_Function created for a non-existent function. This seems weird as Twig should be preventing it before reaching that point. It seems even more weird if it happens only on Symfony 3. I will look into it this evening

craue commented 9 years ago

@stof, any news? I remember when I once tried to find out what's wrong there, it led me to something Assetic-related.

craue commented 9 years ago

@stof, I'm still getting that fatal error Call to a member function needsEnvironment() on boolean in /home/travis/build/craue/CraueConfigBundle/vendor/twig/twig/lib/Twig/Node/Expression/Function.php on line 25 with current 3.0 dev, see https://travis-ci.org/craue/CraueConfigBundle/jobs/93953095#L278.

stof commented 9 years ago

@craue can you run a build without disabling xdebug, so that we can get a stack trace for the fatal error ?

craue commented 9 years ago

@stof, https://travis-ci.org/craue/CraueConfigBundle/builds/93957300#L278

stof commented 9 years ago

@craue this is because your functional test kernel is not enabling the Asset component, and so the asset function is not defined. Assetic needs it.

And the Twig_Node_Expression_Function does not check for the function existence as it expects it to have been validated earlier when parsing the template (and the Assetic node does not validate whether the function is registered or no). This is why you get a fatal error rather than an exception.

craue commented 9 years ago

@stof, now I remember having fixed that in commit 8afeeead17ae8e178bdf2bf04b1262f59cb4be03 already. :laughing: Shame on me.

stof commented 9 years ago

@craue just cherry-pick this commit to merge it in master :smile:

craue commented 9 years ago

Issue is that PrependExtensionInterface is not available in Symfony 2.1, so I got that fix waiting in the branch to drop support for 2.1 and 2.2. I just didn't remember that. Now I'm back on track and will release a new version when 3.0 got stable. :smirk:

stof commented 9 years ago

@craue you can put this in AppKernel::registerContainerConfiguration directly in your testsuite. It will be simpler :smile:

craue commented 9 years ago

With a separate config file for >=3.0? I'm already using multiple config files for various test scenarios. That would complicate things.

stof commented 9 years ago

@craue you can load closures too. See https://github.com/symfony/assetic-bundle/blob/master/Tests/TestKernel.php

craue commented 9 years ago

@stof, thanks. Done in 27bf675355fce6e1ac3edbbcda148ed94a6a8900.