schmittjoh / JMSDiExtraBundle

Provides Advanced Dependency Injection Features for Symfony2
http://jmsyst.com/bundles/JMSDiExtraBundle
330 stars 130 forks source link

Problem after update - parameter passed to "new JMSDiExtraBundle($this)" #151

Closed ozzmaster closed 10 years ago

ozzmaster commented 10 years ago

I don't think this bundle is the problem, but I am hoping posting this issue will help me identify other people with the same problem. I can not find where this call is made that causes the error.

After a composer update of my project this morning I get the following error:

Loading composer repositories with package information Updating dependencies (including require-dev) Writing lock file Generating autoload files PHP Catchable fatal error: Argument 1 passed to JMS\DiExtraBundle\JMSDiExtraBundle::__construct() must implement interface Symfony\Component\HttpKernel\KernelInterface, none given in /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/jms/di-extra-bundle/JMS/DiExtraBundle/JMSDiExtraBundle.php on line 33 Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception

[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

This is my composer.json file:

{ "name": "symfony/framework-standard-edition", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.3.@dev", "doctrine/orm": "2.3.@dev", "doctrine/doctrine-bundle": "1.2.@dev", "gedmo/doctrine-extensions": "2.3.@dev", "twig/extensions": "1.0.@dev", "symfony/assetic-bundle": "2.3.@dev", "symfony/swiftmailer-bundle": "2.2.@dev", "symfony/monolog-bundle": "2.2.@dev", "sensio/distribution-bundle": "2.2.@dev", "sensio/framework-extra-bundle": "2.2.@dev", "sensio/generator-bundle": "2.2.@dev", "jms/security-extra-bundle": "1.5.@dev", "jms/di-extra-bundle": "1.4.@dev", "doctrine/doctrine-fixtures-bundle": "dev-master", "knplabs/knp-paginator-bundle": "dev-master", "knplabs/knp-menu-bundle": "dev-master as 1.1", "sonata-project/admin-bundle": "dev-master", "sonata-project/doctrine-orm-admin-bundle": "2.2.@dev", "sonata-project/user-bundle": "2.2.@dev", "sonata-project/cache-bundle": "2.1.@dev", "sonata-project/core-bundle": "2.2.@dev", "friendsofsymfony/jsrouting-bundle": "dev-master", "mopa/bootstrap-bundle": "dev-master", "twbs/bootstrap": "dev-master", "craue/formflow-bundle": "dev-master", "liip/theme-bundle": "dev-master", "noiselabs/smarty-bundle": "dev-master", "egeloen/ckeditor-bundle": "dev-master", "simplethings/entity-audit-bundle": "dev-master", "egeloen/google-map-bundle": "2.1.@dev", "kriswallsmith/buzz": "", "willdurand/geocoder": "2.2.@dev", "widop/http-adapter-bundle": "1.1.@dev", "symfony/stopwatch": "2.3.@dev", "pk/markdownify-bundle": "dev-master", "gregwar/captcha-bundle": "dev-master", "friendsofsymfony/elastica-bundle": "3.0.*@dev" }, "scripts": { "post-install-cmd": [ "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile", "Mopa\Bundle\BootstrapBundle\Composer\ScriptHandler::postInstallSymlinkTwitterBootstrap" ], "post-update-cmd": [ "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets", "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile", "Mopa\Bundle\BootstrapBundle\Composer\ScriptHandler::postInstallSymlinkTwitterBootstrap" ] },

"include-path": ["vendor/smarty/smarty/distribution/libs/"],

"minimum-stability": "dev",
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web"
}

}

This is my AppKernel.php:

<?php

use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new JMS\AopBundle\JMSAopBundle(), new JMS\DiExtraBundle\JMSDiExtraBundle($this), new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), new IGA\CoreBundle\IGACoreBundle(), new IGA\SessionsBundle\IGASessionsBundle(), new IGA\ContentBundle\IGAContentBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new NoiseLabs\Bundle\SmartyBundle\SmartyBundle(), new Ivory\CKEditorBundle\IvoryCKEditorBundle(), new Mopa\Bundle\BootstrapBundle\MopaBootstrapBundle(), new Sonata\AdminBundle\SonataAdminBundle(), new Sonata\CoreBundle\SonataCoreBundle(), new Sonata\BlockBundle\SonataBlockBundle(), new Sonata\CacheBundle\SonataCacheBundle(), new Sonata\jQueryBundle\SonatajQueryBundle(), new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new Liip\ThemeBundle\LiipThemeBundle(), new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(), new Ivory\GoogleMapBundle\IvoryGoogleMapBundle(), new Widop\HttpAdapterBundle\WidopHttpAdapterBundle(), new PK\MarkdownifyBundle\PKMarkdownifyBundle(), new Gregwar\CaptchaBundle\GregwarCaptchaBundle(), new FOS\ElasticaBundle\FOSElasticaBundle(), new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new IGA\UserBundle\IGAUserBundle(), new IGA\AccessBundle\IGAAccessBundle(), new IGA\GeographyBundle\IGAGeographyBundle(), new IGA\ContactBundle\IGAContactBundle(), new IGA\ShoppingCartBundle\IGAShoppingCartBundle(), new IGA\StatsBundle\IGAStatsBundle(), new IGA\CompanyBundle\IGACompanyBundle(), new IGA\AdsBundle\IGAAdsBundle(), new IGA\AccountingBundle\IGAAccountingBundle(), new IGA\TravelBundle\IGATravelBundle(), );

    if (in_array($this->getEnvironment(), array('dev', 'test'))) {
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
        $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
    }

    return $bundles;
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
    $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}

}

ozzmaster commented 10 years ago

Further debug info from my unit tests revealed the problem might be Twig:

Argument 1 passed to JMS\DiExtraBundle\JMSDiExtraBundle::__construct() must implement interface Symfony\Component\HttpKernel\KernelInterface, none given

/home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/jms/di-extra-bundle/JMS/DiExtraBundle/JMSDiExtraBundle.php:33 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php:158 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php:72 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php:50 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php:39 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:118 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:623 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/app/bootstrap.php.cache:633 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/app/bootstrap.php.cache:412 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:47 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/src/IGA/UserBundle/Tests/Controller/DefaultControllerTest.php:36 /home/otto/wwwroots/BitBucket/iga-core-symfony/iga-core-2.1/src/IGA/UserBundle/Tests/Controller/UserTypeTypesAdminControllerTest.php:24

peshi commented 10 years ago

I have the same issue here.

https://github.com/symfony/symfony/issues/9924

I'm thinking that it's this PR that caused it. https://github.com/symfony/TwigBundle/commit/8200251916993836b4b7bb23b8843274d6483dc5

schmittjoh commented 10 years ago

As this cannot be caused by this bundle (nothing has changed), and the call stack apparently originates from Twig. I'd suggest to open an issue on symfony to talk about this.