Home > Software engineering >  When running "php bin/console list", Symfony prints the code for several classes inside th
When running "php bin/console list", Symfony prints the code for several classes inside th

Time:10-26

I've taken over a code base of a Symfony 4.4-project, with a couple of extra bundles installed (Sonata being the biggest one). When I write: php bin/console list, then it prints the source code for several of the classes in the src/Admin-directory. And I can't figure out why.

I've searched the code for print, var_dump and dump, but can't figure out where this is.

I'm not familiar enough with Symfony, to go through the code 'from the top', adding my own dump-statements, narrowing it down, where this code is coming from.

Had this been Laravel, then I would have started in the routes, then moved on to maybe the kernel or middleware, then to the controlles - and in the end the views.

Does anyone have a good suggestion on which files to add dump-statements to, to see where this code is coming from? ... Or if anyone else has a good idea on how to find this code, then I'm all ears.

Is it maybe an entire namespace that is printed? And can one even do that?! Hmm...


This is what it looks like:

PHP bin/console

CodePudding user response:

You'll get this behavior if the code you've inherited uses short open tags <? but your personal dev environment's PHP installation has them disabled. Run php --ini to find where your ini file is and then edit that to change from this:

short_open_tag = Off

To this:

short_open_tag = On

Alternatively, you could edit all the source files and change the short open tags <? to long open tags <?php.

  • Related