Skip to content

[SecurityBundle] Fix listing listeners in profiler when authenticator manager is disabled #44016

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
Nov 12, 2021

Conversation

94noni
Copy link
Contributor

@94noni 94noni commented Nov 11, 2021

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix profiler v5.4.0.beta1
License MIT

I am trying to upgrade an app from v4.4 to v5.4 beta1
when going to the profiler > security panel, I got this error:
Neither the property "listeners" nor one of the methods "listeners()", "getlisteners()"/"islisteners()"/"haslisteners()" or "__call()" exist and have public access in class "Symfony\Component\VarDumper\Cloner\Data".

This PR tries to fix this in Twig, I do not know the collector logic to fix differently

@carsonbot carsonbot added this to the 5.4 milestone Nov 11, 2021
@carsonbot carsonbot changed the title Update security.html.twig [SecurityBundle] Update security.html.twig Nov 11, 2021
@@ -233,7 +233,11 @@
{% else %}
<tr>
<th>listeners</th>
<td>{{ collector.firewall.listeners is empty ? '(none)' : profiler_dump(collector.firewall.listeners, maxDepth=1) }}</td>
<td>
{% if collector.firewall.listeners is defined %}
Copy link
Member

@jderusse jderusse Nov 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should'nt we display something is the listeners is not defined?

what's about (not tested)

<td>{{ collector.firewall.listeners|default ? profiler_dump(collector.firewall.listeners, maxDepth=1) : '(none)' }}</td>

@xabbuh
Copy link
Member

xabbuh commented Nov 12, 2021

@94noni Can you show the output of composer show for your application when you run into this?

@94noni
Copy link
Contributor Author

94noni commented Nov 12, 2021

@xabbuh here you are:

94noni/html2pdf-bundle               dev-main 5fb55a8  Html2pdf for Symfony.
beberlei/doctrineextensions          v1.3.0            A set of extensions to Doctrine 2 that add support for ...
behat/transliterator                 v1.3.0            String transliterator
composer/package-versions-deprecated 1.11.99.4         Composer plugin that provides efficient querying for in...
composer/semver                      3.2.6             Semver library that offers utilities, version constrain...
composer/xdebug-handler              2.0.2             Restarts a process without Xdebug.
doctrine/annotations                 1.13.2            Docblock Annotations Parser
doctrine/cache                       2.1.1             PHP Doctrine Cache library is a popular cache implement...
doctrine/collections                 1.6.8             PHP Doctrine Collections library that adds additional f...
doctrine/common                      3.2.0             PHP Doctrine Common project is a library that provides ...
doctrine/dbal                        2.13.4            Powerful PHP database abstraction layer (DBAL) with man...
doctrine/deprecations                v0.5.3            A small layer on top of trigger_error(E_USER_DEPRECATED...
doctrine/doctrine-bundle             2.4.3             Symfony DoctrineBundle
doctrine/doctrine-migrations-bundle  3.2.0             Symfony DoctrineMigrationsBundle
doctrine/event-manager               1.1.1             The Doctrine Event Manager is a simple PHP event system...
doctrine/inflector                   2.0.4             PHP Doctrine Inflector is a small library that can perf...
doctrine/instantiator                1.4.0             A small, lightweight utility to instantiate objects in ...
doctrine/lexer                       1.2.1             PHP Doctrine Lexer parser library that can be used in T...
doctrine/migrations                  3.3.0             PHP Doctrine Migrations project offer additional functi...
doctrine/orm                         2.10.2            Object-Relational-Mapper for PHP
doctrine/persistence                 2.2.3             The Doctrine Persistence project is a set of shared int...
doctrine/sql-formatter               1.1.2             a PHP SQL highlighting library
egulias/email-validator              3.1.2             A library for validating emails against several RFCs
friendsofphp/php-cs-fixer            v3.2.1            A tool to automatically fix PHP code style
friendsofphp/proxy-manager-lts       v1.0.5            Adding support for a wider range of PHP versions to ocr...
gedmo/doctrine-extensions            v3.1.0            Doctrine2 behavioral extensions
knplabs/knp-components               v3.3.0            Knplabs component library
knplabs/knp-paginator-bundle         v5.7.0            Paginator bundle for Symfony to automate pagination and...
laminas/laminas-code                 4.4.3             Extensions to the PHP Reflection API, static code scann...
laminas/laminas-json                 3.3.0             provides convenience methods for serializing native PHP...
monolog/monolog                      2.3.5             Sends your logs to files, sockets, inboxes, databases a...
nikic/php-parser                     v4.13.1           A PHP parser written in PHP
ob/highcharts-bundle                 1.7               Symfony Bundle that ease the use of highcharts to displ...
php-cs-fixer/diff                    v2.0.2            sebastian/diff v3 backport support for PHP 5.6+
phpstan/phpstan                      1.1.2             PHPStan - PHP Static Analysis Tool
psr/cache                            1.0.1             Common interface for caching libraries
psr/container                        1.1.2             Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                 1.0.0             Standard interfaces for event handling.
psr/log                              1.1.4             Common interface for logging libraries
pyrech/composer-changelogs           v1.8.0            Display changelogs after each composer update
rector/rector                        dev-main 4612216  Prefixed and PHP 7.1 downgraded version of rector/rector
sensio/framework-extra-bundle        v6.2.1            This bundle provides a way to configure your controller...
spipu/html2pdf                       v5.2.3            Html2Pdf is a HTML to PDF converter written in PHP5 (it...
stof/doctrine-extensions-bundle      v1.6.0            Integration of the gedmo/doctrine-extensions with Symfony
swiftmailer/swiftmailer              v6.3.0            Swiftmailer, free feature-rich PHP mailer
symfony/apache-pack                  v1.0.1            A pack for Apache support in Symfony
symfony/asset                        v5.4.0-BETA1      Manages URL generation and versioning of web assets suc...
symfony/browser-kit                  v5.4.0-BETA1      Simulates the behavior of a web browser, allowing you t...
symfony/cache                        v5.4.0-BETA1      Provides an extended PSR-6, PSR-16 (and tags) implement...
symfony/cache-contracts              v2.4.0            Generic abstractions related to caching
symfony/config                       v5.4.0-BETA1      Helps you find, load, combine, autofill and validate co...
symfony/console                      v5.4.0-BETA1      Eases the creation of beautiful and testable command li...
symfony/css-selector                 v5.4.0-BETA1      Converts CSS selectors to XPath expressions
symfony/debug-bundle                 v5.4.0-BETA1      Provides a tight integration of the Symfony Debug compo...
symfony/dependency-injection         v5.4.0-BETA1      Allows you to standardize and centralize the way object...
symfony/deprecation-contracts        v2.4.0            A generic function and convention to trigger deprecatio...
symfony/doctrine-bridge              v5.4.0-BETA1      Provides integration for Doctrine with various Symfony ...
symfony/dom-crawler                  v5.4.0-BETA1      Eases DOM navigation for HTML and XML documents
symfony/dotenv                       v5.4.0-BETA1      Registers environment variables from a .env file
symfony/error-handler                v5.4.0-BETA1      Provides tools to manage errors and ease debugging PHP ...
symfony/event-dispatcher             v5.4.0-BETA1      Provides tools that allow your application components t...
symfony/event-dispatcher-contracts   v2.4.0            Generic abstractions related to dispatching event
symfony/expression-language          v5.4.0-BETA1      Provides an engine that can compile and evaluate expres...
symfony/filesystem                   v5.4.0-BETA1      Provides basic utilities for the filesystem
symfony/finder                       v5.4.0-BETA1      Finds files and directories via an intuitive fluent int...
symfony/flex                         v1.17.2           Composer plugin for Symfony
symfony/form                         v5.4.0-BETA1      Allows to easily create, process and reuse HTML forms
symfony/framework-bundle             v5.4.0-BETA1      Provides a tight integration between Symfony components...
symfony/http-client                  v5.4.0-BETA1      Provides powerful methods to fetch HTTP resources synch...
symfony/http-client-contracts        v2.4.0            Generic abstractions related to HTTP clients
symfony/http-foundation              v5.4.0-BETA1      Defines an object-oriented layer for the HTTP specifica...
symfony/http-kernel                  v5.4.0-BETA1      Provides a structured process for converting a Request ...
symfony/intl                         v5.4.0-BETA1      Provides a PHP replacement layer for the C intl extensi...
symfony/mailer                       v5.4.0-BETA1      Helps sending emails
symfony/maker-bundle                 v1.34.1           Symfony Maker helps you create empty commands, controll...
symfony/mime                         v5.4.0-BETA1      Allows manipulating MIME messages
symfony/monolog-bridge               v5.4.0-BETA1      Provides integration for Monolog with various Symfony c...
symfony/monolog-bundle               v3.7.1            Symfony MonologBundle
symfony/options-resolver             v5.4.0-BETA1      Provides an improved replacement for the array_replace ...
symfony/password-hasher              v5.4.0-BETA1      Provides password hashing utilities
symfony/phpunit-bridge               v5.4.0-BETA1      Provides utilities for PHPUnit, especially user depreca...
symfony/polyfill-ctype               v1.23.0           Symfony polyfill for ctype functions
symfony/polyfill-iconv               v1.23.0           Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme       v1.23.1           Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu            v1.23.0           Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn            v1.23.0           Symfony polyfill for intl's idn_to_ascii and idn_to_utf...
symfony/polyfill-intl-normalizer     v1.23.0           Symfony polyfill for intl's Normalizer class and relate...
symfony/polyfill-mbstring            v1.23.1           Symfony polyfill for the Mbstring extension
symfony/polyfill-php72               v1.23.0           Symfony polyfill backporting some PHP 7.2+ features to ...
symfony/polyfill-php73               v1.23.0           Symfony polyfill backporting some PHP 7.3+ features to ...
symfony/polyfill-php80               v1.23.1           Symfony polyfill backporting some PHP 8.0+ features to ...
symfony/polyfill-php81               v1.23.0           Symfony polyfill backporting some PHP 8.1+ features to ...
symfony/process                      v5.4.0-BETA1      Executes commands in sub-processes
symfony/property-access              v5.4.0-BETA1      Provides functions to read and write from/to an object ...
symfony/property-info                v5.4.0-BETA1      Extracts information about PHP class' properties using ...
symfony/routing                      v5.4.0-BETA1      Maps an HTTP request to a set of configuration variables
symfony/runtime                      5.4.x-dev 1fb6017 Enables decoupling PHP applications from global state
symfony/security-bundle              v5.4.0-BETA1      Provides a tight integration of the Security component ...
symfony/security-core                v5.4.0-BETA1      Symfony Security Component - Core Library
symfony/security-csrf                v5.4.0-BETA1      Symfony Security Component - CSRF Library
symfony/security-guard               v5.4.0-BETA1      Symfony Security Component - Guard
symfony/security-http                v5.4.0-BETA1      Symfony Security Component - HTTP Integration
symfony/serializer                   v5.4.0-BETA1      Handles serializing and deserializing data structures, ...
symfony/service-contracts            v2.4.0            Generic abstractions related to writing services
symfony/stopwatch                    v5.4.0-BETA1      Provides a way to profile code
symfony/string                       v5.4.0-BETA1      Provides an object-oriented API to strings and deals wi...
symfony/swiftmailer-bundle           v3.5.2            Symfony SwiftmailerBundle
symfony/translation                  v5.4.0-BETA1      Provides tools to internationalize your application
symfony/translation-contracts        v2.4.0            Generic abstractions related to translation
symfony/twig-bridge                  v5.4.0-BETA1      Provides integration for Twig with various Symfony comp...
symfony/twig-bundle                  v5.4.0-BETA1      Provides a tight integration of Twig into the Symfony f...
symfony/validator                    v5.4.0-BETA1      Provides tools to validate values
symfony/var-dumper                   v5.4.0-BETA1      Provides mechanisms for walking through any arbitrary P...
symfony/var-exporter                 v5.4.0-BETA1      Allows exporting any serializable PHP data structure to...
symfony/web-profiler-bundle          v5.4.0-BETA1      Provides a development tool that gives detailed informa...
symfony/webpack-encore-bundle        v1.12.0           Integration with your Symfony app & Webpack Encore!
symfony/workflow                     v5.4.0-BETA1      Provides tools for managing a workflow or finite state ...
symfony/yaml                         v5.4.0-BETA1      Loads and dumps YAML files
tecnickcom/tcpdf                     6.4.2             TCPDF is a PHP class for generating PDF documents and b...
twig/extra-bundle                    v3.3.3            A Symfony bundle for extra Twig extensions
twig/intl-extra                      v3.3.3            A Twig extension for Intl
twig/twig                            v3.3.3            Twig, the flexible, fast, and secure template language ...
vincentlanglet/twig-cs-fixer         0.4.1             A tool to automatically fix Twig code style

FYI, it is when the security.enable_authenticator_manager: false

After upgrading to the new security logic, there is no problem

@chalasr
Copy link
Member

chalasr commented Nov 12, 2021

The bug was introduced in 3ec5e96#diff-e0854f6b2ba3388ec69473baf0dcfcba7db87daad4a3efc86d3a063a00407830R197 whereFirewallConfig::getListeners() was renamed to getAuthenticators() (that's inline with the new authenticator system).

I think we can always use authenticators instead of listeners here, so the right fix would be to remove the {% if collector.authenticatorManagerEnabled %} condition along with the entire else block.

@94noni
Copy link
Contributor Author

94noni commented Nov 12, 2021

@chalasr I've remade the PR, is that what you had in mind? feel free to take over if needed :)

@chalasr chalasr changed the title [SecurityBundle] Update security.html.twig [SecurityBundle] Fix listing listeners in profiler when authenticator manager is disabled Nov 12, 2021
@chalasr
Copy link
Member

chalasr commented Nov 12, 2021

It is but I changed my mind meanwhile :) Just force-pushed your PR.

@fabpot
Copy link
Member

fabpot commented Nov 12, 2021

Thank you @94noni.

@fabpot fabpot merged commit 9211bcc into symfony:5.4 Nov 12, 2021
This was referenced Nov 14, 2021
@94noni 94noni deleted the patch-1 branch December 23, 2021 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants