Closed
Description
I think the handling of the _format get parameter is faulty. The handling of the parameter seems to be enabled on default, causing 500 errors when humans (or bots) append the ?_format=json
to any url of a symfony application.
As I see it, the handling of the _format
parameter should only be handled as I as a developer specify it.
To reproduce:
When you run the following in a standard symfony-standard 2.3 checkout
/app_dev.php/hello/fieg?_format=json
You'll receive a 500 error page, this this error:
[2013-09-09 11:17:42] request.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "Unable to find template "FiegFiegBundle:Default:index.json.twig"." at /vagrant/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php line 133 {"exception":"[object] (InvalidArgumentException: Unable to find template \"FiegFiegBundle:Default:index.json.twig\". at /vagrant/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:133, Twig_Error_Loader: Unable to find template \"FiegFiegBundle:Default:index.json.twig\". at /vagrant/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php:104, InvalidArgumentException: Unable to find template \"FiegFiegBundle:Default:index.json.twig\" : \"Unable to find file \"@FiegFiegBundle/Resources/views/Default/index.json.twig\".\". at /vagrant/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php:81, InvalidArgumentException: Unable to find file \"@FiegFiegBundle/Resources/views/Default/index.json.twig\". at /vagrant/app/bootstrap.php.cache:2292)"} []
This is the case for every route in your application!
I asked some people on IRC (#symfony channel) about this and they agreed that this must be a bug.