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

[router] Does not take additional GET parameter in account if it has a default value. #18035

Copy link
Copy link
Closed
@Alsatian67

Description

@Alsatian67
Issue body actions

In a Controller, I have two actions :

    /**
     * @Route("/search", name="search_with_default", defaults={"p"=1})
     */
    public function searchWithDefaultAction(Request $request)
    {
        return $this->render('default/index.html.twig');
    }

    /**
     * @Route("/search", name="search_without_default")
     */
    public function searchWithoutDefaultAction(Request $request)
    {
        return $this->render('default/index.html.twig');
    }

In twig, I generate routes to these actions with an additional GET parameter 'p' :

    {{ path('search_with_default',{'p':2}) }}<br/>
    {{ path('search_without_default',{'p':2}) }}

Result :

/app_dev.php/search
/app_dev.php/search?p=2 

The first one, totally ignore the value assigned on 'p'.

Bug reproduced here :

https://github.com/Alsatian67/symfony-standard

(index page shows the two paths)

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

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