2

I'm having this error in the bootstrap (both app_dev and app) and I'm actually quite lost at this point:

FatalThrowableError in ContainerBuilder.php line 219: Type error: Argument 1 passed to Symfony\Component\DependencyInjection\ContainerBuilder::addResource() must implement interface Symfony\Component\Config\Resource\ResourceInterface, instance of Symfony\Component\Config\Resource\FileResource given, called in /var/www/sellbytel2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php on line 279

    in ContainerBuilder.php line 219
    at ContainerBuilder->addResource(object(FileResource)) in ContainerBuilder.php line 279
    at ContainerBuilder->addClassResource(object(ReflectionClass)) in ContainerBuilder.php line 258
    at ContainerBuilder->addObjectResource(object(AppKernel)) in Kernel.php line 578
    at Kernel->buildContainer() in Kernel.php line 486
    at Kernel->initializeContainer() in Kernel.php line 116
    at Kernel->boot() in Kernel.php line 165
    at Kernel->handle(object(Request)) in app_dev.php line 12

I've been digging a bit in the symfony code and I found that the error occurs when the kernel is iniciated (new AppKernel('dev', true)) but I don't understand why this could be happening.

To make things mmore strange thisi is only happening in my staging env, in my dev env works fine (vagrant with centos, same thing as staging).

I'm using Symfony 3.2.9 Here are the contents of the app_dev.php file

<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;

/** @var \Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../app/autoload.php';
Debug::enable();

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

1 Answer 1

15

Hard remove all your app/cache/* or var/cache/*

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks - I had this issue after updating to Symfony 3.4, and then going back to work on a branch on 3.2 - very frustrating for a bit there, but your answer solved the issue :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.