The Symfony PHP framework https://symfony.com
Find a file
Fabien Potencier cbe797f88e
bug #62571 [Console] Fix profile invokable command (Jibbarth)
This PR was merged into the 7.4 branch.

Discussion
----------

[Console] Fix profile invokable command

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | yes
| New feature?  | no <!-- if yes, also update src/**/CHANGELOG.md -->
| Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #"; no need to create an issue if none exists, explain below -->
| License       | MIT

Hello,

I noticed that, when I try to profile an invokable command on 7.4, it raise the following exception :

```
[critical] Uncaught Error: ReflectionFunction::__construct(): Argument #1 ($function) must be of type Closure|string, App\Command\MyAwesomeCommand given
TypeError {#199
  #message: "ReflectionFunction::__construct(): Argument #1 ($function) must be of type Closure|string, App\Command\MyAwesomeCommand given"
  #code: 0
  #file: "./vendor/symfony/console/Command/TraceableCommand.php"
  #line: 172
  trace: {
    ./vendor/symfony/console/Command/TraceableCommand.php:172 { …}
    ./vendor/symfony/console/Command/TraceableCommand.php:71 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:115 { …}
    ./vendor/symfony/console/Application.php:356 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:77 { …}
    ./vendor/symfony/console/Application.php:195 { …}
    ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
    ./vendor/autoload_runtime.php:32 { …}
    ./bin/console:15 {
```

The invokableCommand class changed, the code attribute doesn't longer contains the closure to code.
Let's use the $invokableCommand->invokable instead that contains the reflectionFunction needed.

Commits
-------

4643bf1b3e [Console] Fix profile invokable command
2025-11-29 18:54:40 +01:00
.github Merge branch '7.3' into 7.4 2025-11-17 09:23:19 +01:00
src/Symfony bug #62571 [Console] Fix profile invokable command (Jibbarth) 2025-11-29 18:54:40 +01:00
.editorconfig Update .editorconfig 2018-09-06 16:22:56 +02:00
.git-blame-ignore-revs - 2025-07-10 10:48:10 +02:00
.gitattributes [JsonStreamer] update .gitattributes paths for JsonStreamer 2025-07-23 00:07:26 -03:00
.gitignore Introduce twig-cs-fixer 2025-09-14 10:01:01 +02:00
.php-cs-fixer.dist.php Merge branch '6.4' into 7.3 2025-11-26 16:55:45 +01:00
.twig-cs-fixer.dist.php Introduce twig-cs-fixer 2025-09-14 10:01:01 +02:00
CHANGELOG-7.0.md Update CHANGELOG for 7.0.10 2024-07-26 16:55:53 +02:00
CHANGELOG-7.1.md Update CHANGELOG for 7.1.10 2024-12-31 15:55:33 +01:00
CHANGELOG-7.2.md Update CHANGELOG for 7.2.8 2025-06-28 10:20:32 +02:00
CHANGELOG-7.3.md Update CHANGELOG for 7.3.7 2025-11-12 12:38:35 +01:00
CHANGELOG-7.4.md Update CHANGELOG for 7.4.0 2025-11-27 14:38:11 +01:00
CODE_OF_CONDUCT.md Replaced full CoC text with link to documentation 2022-01-24 23:57:46 +01:00
composer.json [HttpKernel] Conflict with symfony/flex < 2.10 2025-11-16 10:44:31 +01:00
CONTRIBUTING.md
CONTRIBUTORS.md Update CONTRIBUTORS for 6.4.28 2025-11-06 21:52:24 +01:00
LICENSE Update license years (last time) 2023-01-24 15:02:46 +01:00
link Add missing Path class required for link tool 2025-11-19 11:15:26 +01:00
phpunit use PHPUnit 12.4 2025-10-08 10:53:36 +02:00
phpunit.xml.dist Use standard MONGODB_URI for test configuration 2025-10-23 01:37:54 +02:00
psalm.xml Merge branch '7.2' into 7.3 2025-02-19 09:51:26 +01:00
README.md - 2025-11-27 09:11:00 +01:00
UPGRADE-7.0.md [SecurityBundle] Add missing removed config options to upgrade guide 2024-01-12 14:47:19 +01:00
UPGRADE-7.1.md Fix typo in typo fix 2024-07-18 09:41:37 +02:00
UPGRADE-7.2.md Proofread UPGRADE guide 2024-11-25 16:21:05 +01:00
UPGRADE-7.3.md Add table of contents in UPGRADE-7.3.md 2025-06-02 09:19:08 +02:00
UPGRADE-7.4.md [HttpFoundation] Deprecate null $format argument to Request::setFormat() 2025-11-02 09:41:14 +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.