Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug | minor | debug-bundle 4.1.0 / var-dumper 4.1.0 #27493

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

Closed
alcohol opened this issue Jun 4, 2018 · 5 comments
Closed

bug | minor | debug-bundle 4.1.0 / var-dumper 4.1.0 #27493

alcohol opened this issue Jun 4, 2018 · 5 comments

Comments

@alcohol
Copy link
Contributor

alcohol commented Jun 4, 2018

Symfony version(s) affected: 4.1.0

Description

The ServerDumpPlaceholderCommand in debug bundle 4.1.0 raises a warning.

This is because it copies its definition from the command it wraps (Symfony\Component\VarDumper\Command\ServerDumpCommand) which does not explicitly set a name, but instead makes use of the lazy loading feature which involves specifying the name through a static property called $defaultName.

Possible Solution

Specify a static $defaultName property just like the command it wraps has.

Additional context

The command defined in "Symfony\Bundle\DebugBundle\Command\ServerDumpPlaceholderCommand" cannot have an empty name.
@alcohol alcohol changed the title bug | minor | debug-bundle 4.1.0 / var-dump 4.1.0 bug | minor | debug-bundle 4.1.0 / var-dumper 4.1.0 Jun 4, 2018
@ogizanagi
Copy link
Contributor

Thanks for the report, but unfortunately I don't understand how you get this exception to be raised. 🤔
There is no need for the $defaultName property as we set the same through the tag command attribute and this command is only meant to be wired by the DebugBundle:

<tag name="console.command" command="server:dump" />

I don't get this exception on my side, so could you provide a reproducer?

@alcohol
Copy link
Contributor Author

alcohol commented Jun 4, 2018

Smallest repro scenario based on third party customer application: https://gist.github.com/alcohol/ec4bac4495ef586d635a37a95f33932f

Replace - with / in filenames (so directory paths).

Run:

docker run -it --rm --user $(id -u):$(id -g) -v $(pwd):/code -w /code composer install
docker run -it --rm --user $(id -u):$(id -g) -v $(pwd):/code -w /code php:7.2-alpine bin/console

Output (should) be:


 [WARNING] Some commands could not be registered:

  The command defined in "Symfony\Bundle\DebugBundle\Command\ServerDumpPlaceholderCommand" cannot have an empty name.

Symfony 3.4.11 (kernel: app, 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

Available commands:
  about                   Displays information about the current project
  help                    Displays help for a command
  list                    Lists commands
 assets
  assets:install          Installs bundles web assets under a public directory
 cache
  cache:clear             Clears the cache
  cache:pool:clear        Clears cache pools
  cache:pool:prune        Prunes cache pools
  cache:warmup            Warms up an empty cache
 config
  config:dump-reference   Dumps the default configuration for an extension
 debug
  debug:autowiring        Lists classes/interfaces you can use for autowiring
  debug:config            Dumps the current configuration for an extension
  debug:container         Displays current services for an application
  debug:event-dispatcher  Displays configured listeners for an application
 lint
  lint:yaml               Lints a file and outputs encountered errors
 server
  server:dump             Starts a dump server that collects and displays dumps in a single place

@alcohol
Copy link
Contributor Author

alcohol commented Jun 4, 2018

Erf. It's because the kernel is still 3.x due to them using the distribution bundle. If I can get them to ditch the distribution bundle in favor of flex, and thus upgrade the kernel to 4.x, it should be solved. I guess you can consider this a non-issue.

@ogizanagi
Copy link
Contributor

Alright, I think I get it. DebugBundle::registerCommands should be noop as for other bundles exposing commands. Could you try #27496 ?
Thanks!

@alcohol
Copy link
Contributor Author

alcohol commented Jun 4, 2018

That resolves it.

nicolas-grekas added a commit that referenced this issue Jun 4, 2018
… (ogizanagi)

This PR was merged into the 4.1 branch.

Discussion
----------

[DebugBundle] DebugBundle::registerCommands should be noop

| Q             | A
| ------------- | ---
| Branch?       | 4.1 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27493   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

Commits
-------

dd4b0ed [DebugBundle] DebugBundle::registerCommands should be noop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants