Skip to content

do not search for service_container references #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2017

Conversation

xabbuh
Copy link
Contributor

@xabbuh xabbuh commented Feb 6, 2017

This fixes #36.

@matthiasnoback
Copy link
Owner

Excellent work as always :)

@xabbuh xabbuh deleted the issue-36 branch February 8, 2017 11:53
@craigh
Copy link
Contributor

craigh commented Feb 9, 2017

this change is now breaking my Symfony-2.8.x application. on composer-update I get these errors:

 [RuntimeException]                                                                                                                                 
  An error occurred when executing the "'cache:clear --no-warmup'" command:                                                                          
  Fatal error: Uncaught exception 'Matthias\SymfonyServiceDefinitionValidator\Exception\InvalidServiceDefinitionsException' with message 'Service d  
  efinition validation errors (3):                                                                                                                   
  - zikula_core.internal.doctrine_init: Argument for type-hint "Symfony\Component\DependencyInjection\ContainerBuilder" points to a service of clas  
  s "Symfony\Component\DependencyInjection\Container"                                                                                                
  - hook_dispatcher.servicefactory: Argument for type-hint "Symfony\Component\DependencyInjection\ContainerBuilder" points to a service of class "S  
  ymfony\Component\DependencyInjection\Container"                                                                                                    
  - doctrine_extensions: Argument for type-hint "Zikula\Bridge\DependencyInjection\ContainerBuilder" points to a service of class "Symfony\Componen  
  t\DependencyInjection\Container"' in /Applications/MAMP/htdocs/core.git/src/vendor/matthiasnoback/symfony-service-definition-validator/Compiler/V  
  alidateServiceDefinitionsPass.php:44                                                                                                               
  Stack trace:                                                                                                                                       
  #0 /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php( in /Application  
  s/MAMP/htdocs/core.git/src/vendor/matthiasnoback/symfony-service-definition-validator/Compiler/ValidateServiceDefinitionsPass.php on line 44       
  .

@craigh
Copy link
Contributor

craigh commented Feb 9, 2017

reverting to 1.2.6 removes the errors and the project builds properly.

@matthiasnoback
Copy link
Owner

matthiasnoback commented Feb 9, 2017 via email

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 9, 2017

@matthiasnoback That won't solve the issue either. The ContainerBuilder class is an instance of the ContainerInterface. But the check is performed the other way around. That's why it's currently failing as the Container class is not an instance of ContainerBuilder.

By the way, expecting a ContainerBuilder in general is fragile. However, this PR shouldn't indeed have broken that. I will look into how to solve this.

@craigh
Copy link
Contributor

craigh commented Feb 9, 2017

I will look into how to solve this

thank you @xabbuh

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 9, 2017

@craigh Is there a test in Zikula I could execute to reproduce the issue?

@craigh
Copy link
Contributor

craigh commented Feb 9, 2017

@xabbuh sadly, no. Zikula isn't quite up to spec on proper tests yet.

you can see here: zikula/core@4d6dd49

that I restricted the version. If you revert that and run composer update on the repo, then you get the error I showed above

@sstok
Copy link

sstok commented Feb 11, 2017

Thanks for fixing this 👍 I did not provide a pr because I wasn't sure how to fix this 😅

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 12, 2017

As far as I can see there is no way to solve the problem without removing the code that validates the argument type hint (no matter what class we used for the pseudo container definition all would fail when the service expects a ContainerBuilder instance).

@matthiasnoback I think we need to drop the type check for the special service_container to not break BC. What do you think?

@matthiasnoback
Copy link
Owner

matthiasnoback commented Feb 12, 2017 via email

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 12, 2017

@matthiasnoback I agree that this solution is not pretty. But since we don't know if people actually do compile the container after it has been build, we don't know if it's safe for them to make these assumptions (like, for example, Zikula seems to always use the ContainerBuilder during runtime instead of a previously dumped one).

@matthiasnoback
Copy link
Owner

@xabbuh Okay, seems fine to me then!

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 18, 2017

@craigh It looks like even if we make the change I suggested above, you will run into the same problems due to the ContainerInterface being registered as a definition in 3.3 (see symfony/symfony#21627).

@xabbuh
Copy link
Contributor Author

xabbuh commented Mar 12, 2017

see #39

craigh referenced this pull request in zikula/core Jun 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

You have requested a non-existent service "service_container".
4 participants