Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form][DX] Enabling the form component without having it installed does not fail #25093

Copy link
Copy link
Closed
@derrabus

Description

@derrabus
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.0.0-RC1

Reproducer: https://github.com/derrabus/symfony-reproducers/tree/bug/no-exception-on-missing-form-component

It is possible to enable the form component without having it actually installed. Container compilation will work without errors and the application remains usable. However, if the console is called without a command, it will bail because of a missing class.

$ ./bin/console
Symfony 4.0.0-RC1 (kernel: src, env: dev, debug: true)

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -e, --env=ENV         The environment name [default: "dev"]
      --no-debug        Switches off debug mode
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

2017-11-21T22:58:12+00:00 [error] An error occurred while using the console. Message: "Class 'Symfony\Component\Form\Command\DebugCommand' not found"
2017-11-21T22:58:12+00:00 [critical] Class 'Symfony\Component\Form\Command\DebugCommand' not found

In getConsole_Command_FormDebugService.php line 8:

  Attempted to load class "DebugCommand" from namespace "Symfony\Component\Form\Command".
  Did you forget a "use" statement for "Symfony\Bridge\Twig\Command\DebugCommand"?


list [--raw] [--format FORMAT] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] [<command>] [<namespace>]

Also, installing Twig will break the container compilation:

$ composer require twig
Using version ^4.0@RC for symfony/twig-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Installing twig/twig (v2.4.4): Loading from cache
  - Installing symfony/twig-bridge (v4.0.0-RC1): Loading from cache
  - Installing symfony/twig-bundle (v4.0.0-RC1): Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 1 recipe (2b3a73184b0320a68c669f39ebe1b621)
  - Configuring symfony/twig-bundle (3.3): From github.com/symfony/recipes:master
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!
!!  In ContainerBuilder.php line 942:
!!
!!    You have requested a non-existent service "twig.extension.form".
!!
!!
!!

Installation failed, reverting ./composer.json to its original content.

Both error messages are imho not helpful. I would expect a nice exception if the Form component is enabled without having it installed, e.g. "Form cannot be enabled. Please install symfony/form first."

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)DX = Developer eXperience (anything that improves the experience of using Symfony)FormFrameworkBundle

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.