TypeError: Argument 7 passed to Symfony\Component\Security\Http\Firewall\ContextListener::__construct() must be callable or null, array given

Hi Guys,

I am getting the error above on

Symfony version(s) affected: 4.4.19


When running my test after upgrading to the last version to Symfony 4.4.19, I am getting this error:

TypeError: Argument 7 passed to Symfony\Component\Security\Http\Firewall\ContextListener::__construct() must be callable or null, array given, called in /tmp/CompanyBundle/cache/ContainerHobmymf/getSecurity_ContextListener_0Service.php on line 12

How to reproduce

It’s a bit difficult to say appropriately how to reproduce it, but I can show you the way my test is written.

$client = static::createClient();

$user = new User();
$client->getContainer()->set('security.token_storage', $this->getTokenStorageMock($user));
$client->request('GET', '/api/v1/public/company/4320/review-token');
self::assertEquals(200, $client->getResponse()->getStatusCode());

It’s failing on the line $client->request('GET', '/api/v1/public/company/4320/review-token');

Effectively when checking the ContextListener constructor signature method the 7th argument is type-hinted as a callable and not an array.

Possible Solution

When I removed the type-hint of callable it suddenly worked, I guess the correction here should be to pass a callable or remove the type-hint.

Additional context
Composer version:

composer show|grep security

symfony/security                           v4.4.19
symfony/security-bundle                    v4.4.19

The cached getSecurity_ContextListener_0Service.php file:

use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;

// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
// Returns the private 'security.context_listener.0' shared service.

return $this->privates['security.context_listener.0'] = new \Symfony\Component\Security\Http\Firewall\ContextListener(($this->privates['security.untracked_token_storage'] ?? ($this->privates['security.untracked_token_storage'] = new \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage())), new RewindableGenerator(function () {
    yield 0 => ($this->privates['security.user.provider.concrete.in_memory_private'] ?? $this->load('getSecurity_User_Provider_Concrete_InMemoryPrivateService.php'));
    yield 1 => ($this->privates['security.user.provider.concrete.db'] ?? $this->load('getSecurity_User_Provider_Concrete_DbService.php'));
}, 2), 'api_user', ($this->privates['monolog.logger.security'] ?? $this->load('getMonolog_Logger_SecurityService.php')), ($this->services['event_dispatcher'] ?? $this->getEventDispatcherService()), ($this->privates['security.authentication.trust_resolver'] ?? ($this->privates['security.authentication.trust_resolver'] = new \Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolver(NULL, NULL))), [0 => ($this->services['security.token_storage'] ?? $this->getSecurity_TokenStorageService()), 1 => 'enableUsageTracking']);

In the past, another issue was opened with the same error please find below the link of the correction which was surely not the same context as it looks like this one was solving the type of TokenStorage.

Previous issue: #36720
Correction: https://github.com/symfony/symfony/pull/38869/files#diff-eb942086a7d2fce031f42c8a40f7926e3f89c1300cb8930a3e1b54e089a4db9bR52

Thanks a lot for the help which is going to be provided.

Feel free to let me know if I need to give more information and context.

1 possible answer(s) on “TypeError: Argument 7 passed to Symfony\Component\Security\Http\Firewall\ContextListener::__construct() must be callable or null, array given

TypeError: Argument 7 passed to Symfony\Component\Security\Http\Firewall\ContextListener::__construct() must be callable or null, array given

Symfony version(s) affected: 4.4.8


Since my last composer update, I have the following error on my test:

1) App\Tests\Admin\InvoiceAdminTest::testAddInvoiceItem
TypeError: Argument 7 passed to Symfony\Component\Security\Http\Firewall\ContextListener::__construct() must be callable or null, array given, called in /app/var/cache/test/ContainerVH2Mbj0/getSecurity_ContextListener_0Service.php on line 11


How to reproduce

Not sure how to reproduce the bug as I don’t really understand it. I’ll fill the additional context instead. If this does not help, I’ll try to go deeper.

Possible Solution

Additional context

InvoiceAdminTest.php (the last line is where the crash occurs):

PHP version info:

PHP 7.3.15 (cli) (built: Feb 26 2020 12:46:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.15, Copyright (c) 1998-2018 Zend Technologies
use AppBundle\Entity\Invoice;
use Tests\AppBundle\Controller\WebTestCase;

final class InvoiceAdminTest extends WebTestCase
     * An added item must be attached to the invoice.
     * @see https://gitlab.com/nexylan/n-admin/issues/1385
    public function testAddInvoiceItem(): void
        $this->loginAs($this->getReference('user_super_admin'), 'main');
        /** @var Invoice $invoice */
        $invoice = $this->getReference('invoice_user_default');
        $client = $this->makeClient();
        $crawler = $client->request('GET', $this->getUrl('admin_invoice_edit', [
            'id' => $invoice->getRef(),

Content of the cached getSecurity_ContextListener_0Service.php file:

use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;

// This file has been auto-generated by the Symfony Dependency Injection Component for internal use.
// Returns the private 'security.context_listener.0' shared service.

return $this->privates['security.context_listener.0'] = new \Symfony\Component\Security\Http\Firewall\ContextListener(($this->privates['security.untracked_token_storage'] ?? ($this->privates['security.untracked_token_storage'] = new \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage())), new RewindableGenerator(function () {
    yield 0 => ($this->privates['fos_user.user_provider.username_email'] ?? $this->load('getFosUser_UserProvider_UsernameEmailService.php'));
}, 1), 'main', ($this->privates['monolog.logger.security'] ?? $this->load('getMonolog_Logger_SecurityService.php')), ($this->services['event_dispatcher'] ?? $this->getEventDispatcherService()), ($this->privates['scheb_two_factor.security.authentication.trust_resolver'] ?? $this->getSchebTwoFactor_Security_Authentication_TrustResolverService()), [0 => ($this->services['security.token_storage'] ?? $this->getSecurity_TokenStorageService()), 1 => 'enableUsageTracking']);

security.yaml config:

    FOS\UserBundle\Model\UserInterface: sha512


      id: fos_user.user_provider.username_email

      pattern: ^/(_(profiler|wdt|error|trans)|css|images|js)/
      security: false

      pattern: ^/(misc|\.well-known)/
      security: false

      pattern: ^/oauth/v2/token
      security: false

      pattern: ^/jwt/login
      stateless: true
      anonymous: true
        check_path: /jwt/login_check
        success_handler: lexik_jwt_authentication.handler.authentication_success
        failure_handler: lexik_jwt_authentication.handler.authentication_failure
        require_previous_session: false

      pattern: ^/api/(?!docs(\.[a-z]+)?$)
      stateless: true
      # This will handle all oauth access token, JWToken and simple private token
        authenticator: security.authentication.authenticator.api_key

      pattern: ^/
      entry_point: security.entry_point.form_authentication
        provider: fos_userbundle
        csrf_token_generator: security.csrf.token_manager
        login_path: /login
        check_path: /login_check
        auth_form_path: 2fa_login
        check_path: 2fa_login_check
      anonymous: ~
        path: /logout
        parameter: "%%switch_user_parameter%%"

test/security.yaml config:

      http_basic: ~

composer show result:

a2lix/auto-form-bundle                   0.3                Automate form building
a2lix/translation-form-bundle            3.0.7              Translate your doctrine objects easily with some helps
algatux/influxdb-bundle                  2.4.0              Bundle service integration of official influxdb/influxdb-php...
api-platform/api-pack                    v1.2.2             A pack for API Platform
api-platform/core                        v2.5.5             Build a fully-featured hypermedia or GraphQL API in minutes
bacon/bacon-qr-code                      2.0.0              BaconQrCode is a QR code generator for PHP.
beberlei/assert                          v3.2.7             Thin assertion library for input validation in business models.
behat/transliterator                     v1.3.0             String transliterator
brick/math                               0.8.15             Arbitrary-precision arithmetic library
browscap/browscap-bundle                 dev-master 6071708 Allows you to get browser information
browscap/browscap-php                    2.1.1              Standalone replacement for php's native get_browser() function
cebe/markdown                            1.2.1              A super fast, highly extensible markdown parser for PHP
clue/stream-filter                       v1.4.1             A simple and modern approach to stream filtering in PHP
cocur/slugify                            v4.0.0             Converts a string into a slug.
dama/doctrine-test-bundle                v5.0.5             Symfony bundle to isolate doctrine database tests and improv...
dasprid/enum                             1.0.0              PHP 7.1 enum implementation
digitick/sepa-xml                        1.6.2              Creates an XML file for a Single Euro Payments Area (SEPA) C...
doctrine/annotations                     1.10.2             Docblock Annotations Parser
doctrine/cache                           1.10.0             PHP Doctrine Cache library is a popular cache implementation...
doctrine/collections                     1.6.4              PHP Doctrine Collections library that adds additional functi...
doctrine/common                          2.12.0             PHP Doctrine Common project is a library that provides addit...
doctrine/data-fixtures                   1.4.2              Data Fixtures for all Doctrine Object Managers
doctrine/dbal                            2.10.2             Powerful PHP database abstraction layer (DBAL) with many fea...
doctrine/doctrine-bundle                 1.12.8             Symfony DoctrineBundle
doctrine/doctrine-cache-bundle           1.4.0              Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle        3.3.1              Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle      v1.3.2             Symfony DoctrineMigrationsBundle
doctrine/event-manager                   1.1.0              The Doctrine Event Manager is a simple PHP event system that...
doctrine/inflector                       1.3.1              Common String Manipulations with regard to casing and singul...
doctrine/instantiator                    1.3.0              A small, lightweight utility to instantiate objects in PHP w...
doctrine/lexer                           1.2.0              PHP Doctrine Lexer parser library that can be used in Top-Do...
doctrine/migrations                      v1.8.1             Database Schema migrations using Doctrine DBAL
doctrine/orm                             v2.7.2             Object-Relational-Mapper for PHP
doctrine/persistence                     1.3.7              The Doctrine Persistence project is a set of shared interfac...
doctrine/reflection                      1.2.1              The Doctrine Reflection project is a simple library used by ...
egulias/email-validator                  2.1.17             A library for validating emails against several RFCs
eightpoints/guzzle-bundle                v7.6.1             Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony 2/3/4...
emojione/emojione                        4.5.0              EmojiOne is a complete set of emojis designed for the web. I...
endroid/installer                        1.2.3             
endroid/qr-code                          3.7.9              Endroid QR Code
endroid/qr-code-bundle                   3.4.3              Endroid QR Code Bundle
excelwebzone/recaptcha-bundle            v1.5.17            This bundle provides easy reCAPTCHA form field integration
exsyst/swagger                           v0.4.1             A php library to manipulate Swagger specifications
fabpot/goutte                            v3.3.0             A simple PHP Web Scraper
fig/link-util                            1.1.1              Common utility implementations for HTTP links
friendsofsymfony/jsrouting-bundle        2.5.4              A pretty nice way to expose your Symfony2 routing to client ...
friendsofsymfony/oauth-server-bundle     1.6.2              Symfony2 OAuth Server Bundle
friendsofsymfony/oauth2-php              1.3.0              OAuth2 library
friendsofsymfony/user-bundle             v2.1.2             Symfony FOSUserBundle
fzaninotto/faker                         v1.9.1             Faker is a PHP library that generates fake data for you.
gedmo/doctrine-extensions                v2.4.39            Doctrine2 behavioral extensions
giggsey/libphonenumber-for-php           8.12.2             PHP Port of Google's libphonenumber
giggsey/locale                           1.8                Locale functions required by libphonenumber-for-php
google/recaptcha                         1.2.4              Client library for reCAPTCHA, a free service that protects w...
greg0ire/enum                            v4.2.1             work around the missing enum type in php
gregwar/cache                            v1.0.12            A lightweight file-system cache system
gregwar/image                            v2.0.28            Image handling
gregwar/image-bundle                     v2.2.4             Image handling bundle
guzzlehttp/guzzle                        6.5.3              Guzzle is a PHP HTTP client library
guzzlehttp/promises                      v1.3.1             Guzzle promises library
guzzlehttp/psr7                          1.6.1              PSR-7 message implementation that also provides common utili...
hackzilla/password-generator             1.5.0              Password Generator Library
hackzilla/password-generator-bundle      3.0.1              Password Generator Bundle
hautelook/alice-bundle                   2.7.2              Symfony bundle to manage fixtures with Alice and Faker.
incenteev/composer-parameter-handler     v2.1.4             Composer script handling your ignored parameter file
influxdb/influxdb-php                    1.15.0             InfluxDB client library for PHP
inlinestyle/inlinestyle                  1.2.7              Apply CSS stylesheets directly as inline styles to a HTML do...
internations/solr-utils                  v0.8.1             Solr/Lucene utilities for PHP
jdorn/sql-formatter                      v1.2.17            a PHP SQL highlighting library
jms/translation-bundle                   1.5.4              Puts the Symfony Translation Component on steroids
jolicode/gif-exception-bundle            v1.6.0             The GhostBuster of your exception page
khanamiryan/qrcode-detector-decoder      1.0.3              QR code decoder / reader
knplabs/doctrine-behaviors               1.6.0              Doctrine2 behavior traits
knplabs/knp-components                   v1.3.10            Knplabs component library
knplabs/knp-markdown-bundle              1.8.1              Knplabs markdown bundle transforms markdown into html
knplabs/knp-menu                         2.6.0              An object oriented menu library
knplabs/knp-menu-bundle                  v2.3.0             This bundle provides an integration of the KnpMenu library
knplabs/knp-paginator-bundle             v2.8.0             Paginator bundle for Symfony to automate pagination and simp...
kriswallsmith/spork                      v0.3               Asynchronous PHP
lcobucci/jwt                             3.3.1              A simple library to work with JSON Web Token and JSON Web Si...
lexik/jwt-authentication-bundle          v2.6.5             This bundle provides JWT authentication for your Symfony RES...
liip/functional-test-bundle              2.0.0-alpha3       This bundles provides additional functional test-cases for S...
lstrojny/fxmlrpc                         0.15.0             Fast and tiny XML/RPC client with bridges for various HTTP c...
mck89/peast                              v1.10.3            Peast is PHP library that generates AST for JavaScript code
michelf/php-markdown                     1.9.0              PHP Markdown
misd/phone-number-bundle                 v1.3.2             Integrates libphonenumber into your Symfony2 application
monolog/monolog                          1.25.3             Sends your logs to files, sockets, inboxes, databases and va...
mtdowling/cron-expression                v1.2.3             CRON for PHP: Calculate the next or previous run date and de...
myclabs/deep-copy                        1.9.5              Create deep copies (clones) of your objects
myclabs/php-enum                         1.7.6              PHP Enum implementation
namshi/jose                              7.2.3              JSON Object Signing and Encryption library for PHP.
nelmio/alice                             v3.6.0             Expressive fixtures generator
nelmio/cors-bundle                       2.0.1              Adds CORS (Cross-Origin Resource Sharing) headers support in...
netresearch/jsonmapper                   v1.6.0             Map nested JSON structures onto PHP classes
nexylan/cloudflare                       v0.3.2             A PHP sdk to communicate with CloudFlare api V4
nexylan/cloudflare-host-gw               v0.2.0             A PHP sdk to communicate with CloudFlare Hosting Provider API
nexylan/gandi-sdk                        v0.4.0             PHP sdk to communicate with the Gandi API
nexylan/graylog-sdk                      v0.6.0             A PHP sdk to communicate with the Graylog REST API
nexylan/nexycrypt                        v0.6.2             Let's Encrypt ACME protocol PHP client
nexylan/paybox-direct                    v0.3.7             PayBox Direct and Direct Plus API wrapper
nexylan/slack                            v2.3.0             A simple PHP package for sending messages to Slack, with a f...
nexylan/slack-bundle                     v2.2.0             Symfony bundle integration of nexylan/slack library
nikic/php-parser                         v4.4.0             A PHP parser written in PHP
ocramius/package-versions                1.5.1              Composer plugin that provides efficient querying for install...
ocramius/proxy-manager                   2.2.3              A library providing utilities to generate, instantiate and g...
ornicar/gravatar-bundle                  1.3.0              This bundles provides a Gravatar API various utilities to wo...
ovh/ovh                                  v2.0.1             Wrapper for OVH APIs
paragonie/constant_time_encoding         v2.3.0             Constant-time Implementations of RFC 4648 Encoding (Base-64,...
paragonie/random_compat                  v2.0.18            PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
patchwork/utf8                           v1.3.2             Portable and performant UTF-8, Unicode and Grapheme Clusters...
php-http/cache-plugin                    1.7.0              PSR-6 Cache plugin for HTTPlug
php-http/client-common                   2.1.0              Common HTTP Client implementations and tools for HTTPlug
php-http/discovery                       1.7.4              Finds installed HTTPlug implementations and PSR-7 message fa...
php-http/guzzle6-adapter                 v2.0.1             Guzzle 6 HTTP Adapter
php-http/httplug                         2.1.0              HTTPlug, the HTTP client abstraction for PHP
php-http/httplug-bundle                  1.18.0             Symfony integration for HTTPlug
php-http/logger-plugin                   1.1.0              PSR-3 Logger plugin for HTTPlug
php-http/message                         1.8.0              HTTP Message related tools
php-http/message-factory                 v1.0.2             Factory interfaces for PSR-7 HTTP Message
php-http/mock-client                     1.3.1              Mock HTTP client
php-http/promise                         v1.0.0             Promise used for asynchronous HTTP requests
php-http/stopwatch-plugin                1.3.0              Symfony Stopwatch plugin for HTTPlug
phpdocumentor/reflection-common          2.1.0              Common reflection classes used by phpdocumentor to reflect t...
phpdocumentor/reflection-docblock        5.1.0              With this component, a library can provide support for annot...
phpdocumentor/type-resolver              1.1.0              A PSR-5 based resolver of Class names, Types and Structural ...
predis/predis                            v1.1.1             Flexible and feature-complete Redis client for PHP and HHVM
psr/cache                                1.0.1              Common interface for caching libraries
psr/container                            1.0.0              Common Container Interface (PHP FIG PSR-11)
psr/http-client                          1.0.0              Common interface for HTTP clients
psr/http-message                         1.0.1              Common interface for HTTP messages
psr/link                                 1.0.0              Common interfaces for HTTP links
psr/log                                  1.1.3              Common interface for logging libraries
psr/simple-cache                         1.0.1              Common interfaces for simple caching
ralouphie/getallheaders                  3.0.3              A polyfill for getallheaders.
ramsey/collection                        1.0.1              A PHP 7.2+ library for representing and manipulating collect...
ramsey/uuid                              4.0.1              A PHP library for generating and working with universally un...
roave/security-advisories                dev-master 81541a7 Prevents installation of composer packages with known securi...
rollerworks/password-strength-bundle     v2.2.0             Password-strength validator bundle for Symfony
rollerworks/password-strength-validator  v1.3.0             Password-strength validator for Symfony
ronanguilloux/isocodes                   2.2.3              PHP library - Validators for standards from ISO, Internation...
scheb/two-factor-bundle                  v4.15.0            Provides two-factor authentication for Symfony applications
sebastian/comparator                     4.0.0              Provides the functionality to compare PHP values for equality
sebastian/diff                           4.0.0              Diff implementation
sebastian/exporter                       4.0.0              Provides the functionality to export PHP variables for visua...
sebastian/recursion-context              4.0.0              Provides functionality to recursively process PHP variables
sensio/framework-extra-bundle            v5.5.4             This bundle provides a way to configure your controllers wit...
simplethings/entity-audit-bundle         v1.0.9             Audit for Doctrine Entities
sllh/iso-codes-validator                 v4.0.0             Symfony validator wrapper of ronanguilloux/isocodes
snc/redis-bundle                         3.2.2              A Redis bundle for Symfony
sonata-project/admin-bundle              3.65.0             The missing Symfony Admin Generator
sonata-project/block-bundle              3.18.4             Symfony SonataBlockBundle
sonata-project/cache                     2.0.1              Cache library
sonata-project/core-bundle               3.18.0             Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle           2.5.0              Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.6.0              Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.17.1             Symfony Sonata / Integrate Doctrine ORM into the SonataAdmin...
sonata-project/easy-extends-bundle       2.5.0              Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.11.1             Lightweight Exporter library
sonata-project/intl-bundle               2.7.0              Symfony SonataIntlBundle
spomky-labs/base64url                    v1.0.2             Base 64 URL Safe Encoding/decoding PHP Library
spomky-labs/otphp                        v10.0.1            A PHP library for generating one time passwords according to...
stof/doctrine-extensions-bundle          v1.4.0             Integration of the gedmo/doctrine-extensions with Symfony2
swiftmailer/swiftmailer                  v6.2.3             Swiftmailer, free feature-rich PHP mailer
symfony/asset                            v4.4.8             Symfony Asset Component
symfony/browser-kit                      v4.4.8             Symfony BrowserKit Component
symfony/cache                            v4.4.8             Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts                  v2.0.1             Generic abstractions related to caching
symfony/config                           v4.4.8             Symfony Config Component
symfony/console                          v4.4.8             Symfony Console Component
symfony/contracts                        v1.1.0             A set of abstractions extracted out of the Symfony components
symfony/css-selector                     v5.0.8             Symfony CssSelector Component
symfony/debug                            v4.4.8             Symfony Debug Component
symfony/debug-bundle                     v4.4.8             Symfony DebugBundle
symfony/dependency-injection             v4.4.8             Symfony DependencyInjection Component
symfony/doctrine-bridge                  v4.4.8             Symfony Doctrine Bridge
symfony/dom-crawler                      v5.0.8             Symfony DomCrawler Component
symfony/dotenv                           v4.4.8             Registers environment variables from a .env file
symfony/error-handler                    v4.4.8             Symfony ErrorHandler Component
symfony/event-dispatcher                 v4.4.8             Symfony EventDispatcher Component
symfony/event-dispatcher-contracts       v1.1.7             Generic abstractions related to dispatching event
symfony/expression-language              v4.4.8             Symfony ExpressionLanguage Component
symfony/filesystem                       v4.4.8             Symfony Filesystem Component
symfony/finder                           v4.4.8             Symfony Finder Component
symfony/flex                             v1.6.2             Composer plugin for Symfony
symfony/form                             v4.4.8             Symfony Form Component
symfony/framework-bundle                 v4.4.8             Symfony FrameworkBundle
symfony/http-foundation                  v4.4.8             Symfony HttpFoundation Component
symfony/http-kernel                      v4.4.8             Symfony HttpKernel Component
symfony/inflector                        v5.0.8             Symfony Inflector Component
symfony/intl                             v4.4.8             A PHP replacement layer for the C intl extension that includ...
symfony/lock                             v4.4.8             Symfony Lock Component
symfony/mime                             v5.0.8             A library to manipulate MIME messages
symfony/monolog-bridge                   v5.0.8             Symfony Monolog Bridge
symfony/monolog-bundle                   v3.5.0             Symfony MonologBundle
symfony/options-resolver                 v4.4.8             Symfony OptionsResolver Component
symfony/phpunit-bridge                   v4.4.8             Symfony PHPUnit Bridge
symfony/polyfill-ctype                   v1.15.0            Symfony polyfill for ctype functions
symfony/polyfill-iconv                   v1.15.0            Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme           v1.15.0            Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu                v1.15.0            Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn                v1.15.0            Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 fun...
symfony/polyfill-intl-normalizer         v1.15.0            Symfony polyfill for intl's Normalizer class and related fun...
symfony/polyfill-mbstring                v1.15.0            Symfony polyfill for the Mbstring extension
symfony/polyfill-php56                   v1.15.0            Symfony polyfill backporting some PHP 5.6+ features to lower...
symfony/polyfill-php72                   v1.15.0            Symfony polyfill backporting some PHP 7.2+ features to lower...
symfony/polyfill-php73                   v1.15.0            Symfony polyfill backporting some PHP 7.3+ features to lower...
symfony/polyfill-util                    v1.15.0            Symfony utilities for portability of PHP codes
symfony/process                          v4.4.8             Symfony Process Component
symfony/property-access                  v4.4.8             Symfony PropertyAccess Component
symfony/property-info                    v4.4.8             Symfony Property Info Component
symfony/proxy-manager-bridge             v4.4.8             Symfony ProxyManager Bridge
symfony/psr-http-message-bridge          v1.3.0             PSR HTTP message bridge
symfony/routing                          v4.4.8             Symfony Routing Component
symfony/security                         v4.4.8             Symfony Security Component
symfony/security-acl                     v3.0.4             Symfony Security Component - ACL (Access Control List)
symfony/security-bundle                  v4.4.8             Symfony SecurityBundle
symfony/serializer                       v4.4.8             Symfony Serializer Component
symfony/service-contracts                v2.0.1             Generic abstractions related to writing services
symfony/stopwatch                        v4.4.8             Symfony Stopwatch Component
symfony/string                           v5.0.8             Symfony String component
symfony/swiftmailer-bundle               v3.4.0             Symfony SwiftmailerBundle
symfony/templating                       v4.4.8             Symfony Templating Component
symfony/translation                      v4.4.8             Symfony Translation Component
symfony/translation-contracts            v2.0.1             Generic abstractions related to translation
symfony/twig-bridge                      v4.4.8             Symfony Twig Bridge
symfony/twig-bundle                      v4.4.8             Symfony TwigBundle
symfony/validator                        v4.4.8             Symfony Validator Component
symfony/var-dumper                       v4.4.8             Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter                     v5.0.8             A blend of var_export() + serialize() to turn any serializab...
symfony/web-link                         v4.4.8             Symfony WebLink Component
symfony/web-profiler-bundle              v4.4.8             Symfony WebProfilerBundle
symfony/webpack-encore-bundle            v1.7.3             Integration with your Symfony app & Webpack Encore!
symfony/yaml                             v4.4.8             Symfony Yaml Component
thecodingmachine/gotenberg-php-client    6.2.0              A client for sending files to a Gotenberg API
thecodingmachine/safe                    v1.1               PHP core functions that throw exceptions instead of returnin...
theofidry/alice-data-fixtures            v1.1.2             Nelmio alice extension to persist the loaded fixtures.
tilleuls/ovh-bundle                      v1.0.2             OVH SDK integration
twig/extensions                          v1.5.4             Common additional features for Twig that do not directly bel...
twig/extra-bundle                        v3.0.3             A Symfony bundle for extra Twig extensions
twig/string-extra                        v3.0.3             A Twig extension for Symfony String
twig/twig                                v2.12.5            Twig, the flexible, fast, and secure template language for PHP
webmozart/assert                         1.8.0              Assertions to validate method input/output with nice error m...
willdurand/jsonp-callback-validator      v1.1.0             JSONP callback validator.
willdurand/negotiation                   v2.3.1             Content Negotiation tools for PHP provided as a standalone l...
zendframework/zend-code                  3.4.1              Extensions to the PHP Reflection API, static code scanning, ...
zendframework/zend-eventmanager          3.2.1              Trigger and listen to events within a PHP application

2 thoughts on “TypeError: Argument 7 passed to Symfony\Component\Security\Http\Firewall\ContextListener::__construct() must be callable or null, array given

  1. Hmm, I think there is something weird here. The UsageTrackingTokenStorage class is only used for lazy firewalls. But you’re using anonymous: true and not anonymous: lazy. Thus I expect the firewall is not lazy.

    But for some reason, something still tries to configure the UsageTrackingTokenStorage.

    (thanks a lot for your very detailed issue description btw!)

  2. The actual patch exists on 4.4:

    if (method_exists($tokenStorageClass, ‘enableUsageTracking’)) {
    ->setArgument(6, [new Reference(‘security.token_storage’), ‘enableUsageTracking’]);

    The PR was merged just after 4.4.16 was released, so unfortunately we have to wait till the end of this month for a release with this patch included. I’m not really sure why the commits only show 5.x, it seems like it might be a GitHub issue.