The Symfony PHP framework https://symfony.com
Find a file
Nicolas Grekas fe9786597d bug #63722 [SecurityBundle] Fix profiler showing ERROR instead of DENIED (audain-dg)
This PR was squashed before being merged into the 7.4 branch.

Discussion
----------

[SecurityBundle] Fix profiler showing ERROR instead of DENIED

The `|default(null)` filter treats boolean `false` as empty and replaces it with `null`, causing the DENIED label to show as ERROR in the Access Decision log.

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #63721
| License       | MIT

## Description

In `security.html.twig`, the Access Decision log Result column shows **ERROR** instead of **DENIED** when a voter denies access.

**Root cause:** Line 537 uses `decision.result|default(null)`. Twig's `default` filter treats `false` as "empty" and replaces it with `null`. The subsequent `result is same as(false)` check fails, falling through to the ERROR branch.

**Fix:** Replace `|default(null)` with `is defined ?` ternary:
```diff
- {% set result = decision.result|default(null) %}
+ {% set result = decision.result is defined ? decision.result : null %}
```

This preserves the boolean `false` value so `result is same as(false)` correctly evaluates to `true` → displays **DENIED**.

Commits
-------

049f5c13d2 [SecurityBundle] Fix profiler showing ERROR instead of DENIED
2026-03-23 21:01:20 +01:00
.github Merge branch '6.4' into 7.4 2026-02-22 23:01:45 +01:00
src/Symfony [SecurityBundle] Fix profiler showing ERROR instead of DENIED 2026-03-23 21:01:16 +01:00
.editorconfig
.git-blame-ignore-revs
.gitattributes
.gitignore
.php-cs-fixer.dist.php PHP CS Fixer: re-apply php_unit_attributes 2025-12-30 11:53:18 +01:00
.twig-cs-fixer.dist.php Configure Twig-CS-Fixer to lint all files and exclude if necessary 2026-01-04 10:46:01 +01:00
CHANGELOG-7.0.md
CHANGELOG-7.1.md
CHANGELOG-7.2.md
CHANGELOG-7.3.md Update CHANGELOG for 7.3.11 2026-01-28 11:19:06 +01:00
CHANGELOG-7.4.md Update CHANGELOG for 7.4.7 2026-03-06 17:33:14 +01:00
CODE_OF_CONDUCT.md
composer.json [PropertyInfo] fix compatibility with phpdocumentor/reflection-docblock 6.x 2026-02-04 15:18:03 +01:00
CONTRIBUTING.md
CONTRIBUTORS.md Update CONTRIBUTORS for 6.4.35 2026-03-06 17:28:06 +01:00
LICENSE
link Add missing Path class required for link tool 2025-11-19 11:15:26 +01:00
phpunit PHPUnit 13 requires PHP 8.4.1 or higher 2026-02-13 13:07:44 +01:00
phpunit.xml.dist Merge branch '6.4' into 7.4 2026-02-22 13:27:52 +01:00
psalm.xml Merge branch '6.4' into 7.3 2025-12-14 09:06:00 +01:00
README.md - 2025-11-27 09:11:00 +01:00
splitsh.json Add contract splitting 2026-01-08 12:14:07 +01:00
UPGRADE-7.0.md
UPGRADE-7.1.md
UPGRADE-7.2.md
UPGRADE-7.3.md Typo 2026-01-06 06:07:11 +01:00
UPGRADE-7.4.md Update ext-redis version to 6.1 in upgrade notes 2026-01-23 16:34:54 +01:00

Symfony Logo

Symfony is a PHP framework for web and console applications and a set of reusable PHP components. Symfony is used by thousands of web applications and most of the popular PHP projects.

Installation

Sponsor

Symfony 7.4 is backed by:

As the creator of Symfony, SensioLabs supports companies using Symfony, with an offering encompassing consultancy, expertise, services, training, and technical assistance to ensure the success of web application development projects.

Private Packagist is a fast, reliable, and secure Composer repository for your private packages. It mirrors all your open-source dependencies for better availability and monitors them for security vulnerabilities.

redirection.io logs all your websites HTTP traffic, and lets you fix errors with redirect rules in seconds. Give your marketing, SEO and IT teams the right tool to manage your website traffic efficiently!

JoliCode is a team of passionate developers and open-source lovers, with a strong expertise in PHP & Symfony technologies. They can help you build your projects using state-of-the-art practices.

Help Symfony by sponsoring its development!

Documentation

Community

Contributing

Symfony is an Open Source, community-driven project with thousands of contributors. Join them contributing code or contributing documentation.

Security Issues

If you discover a security vulnerability within Symfony, please follow our disclosure procedure.

About Us

Symfony development is led by the Symfony Core Team and supported by Symfony contributors.