Skip to content

debug:config command uses Yaml without checking for it's presence #48429

@kaznovac

Description

@kaznovac

Symfony version(s) affected

x

Description

running debug:config framework throws exception when symfony/yaml package is not installed

Yaml is used for output formatting:

$io->writeln(Yaml::dump($config, 10));

$ php bin/console debug:config framework

Current configuration for extension with alias "framework"
==========================================================

[critical] Error thrown while running command "debug:config framework". Message: "Class "Symfony\Component\Yaml\Yaml" not found"

In ConfigDebugCommand.php line 100:
                                                                           
  Attempted to load class "Yaml" from namespace "Symfony\Component\Yaml".  
  Did you forget a "use" statement for another namespace?                  
                                                                           

debug:config [--resolve-env] [--] [<name> [<path>]]

2022-12-01T14:06:28+00:00 [critical] Uncaught Error: Class "Symfony\Component\Yaml\Yaml" not found

How to reproduce

create empty symfony project
change config format from yaml to php
remove symfony/yaml from composer dependencies
run debug:config framework

Possible Solution

use backoff formatting helper (e.g. var_export, print_r, json_serialize, ...) for output

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions