Skip to content

_format parameter handling enabled on default, potentially causing 500 errors #8966

@fieg

Description

@fieg

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.

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy