Skip to content

Behavior Change: Incorrect controller arguments no longer throw exception #20746

Closed
@weaverryan

Description

@weaverryan

Hi guys!

The commit sha: 9c48756 (cc @iltar) changed some behavior in all versions of Symfony, I think on accident.

Consider the following:

/**
 * @Route("/product/{id}")
 */
public function showAction($id2)
{
}

Previously, this would have thrown the following error:

Controller "SomeController::showAction" requires that you provide a value for the "$id2" argument (because there is no default value or because there is a non optional argument after this one).

But after this commit, it does not throw the error, and instead $id2 is set to null in all cases. The specific problem is this block: 9c48756#diff-8518ab757bc9acd6d5a874a2e2737502R135

Was this expected? It's a step back in DX, as you can now silently mess up your route param without being notified.

Cheers!

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