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

[ErrorHandler] Do not patch return statements in closures #49346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

wouterj
Copy link
Member

@wouterj wouterj commented Feb 12, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

The type patcher script also fixes some return statements automatically to deal with void/null differences. However, the script is a bit too eager and also patches return statements of closures inside methods:

public function something(): void
{
    $someHandler = function (): ?string {
        if (...) {
            return null;
        }
    };
}

Statements like this were patched to return;, causing a PHP fatal error.

Note: I didn't find any test for the return statement patching, so I also didn't write one for this bug. However, this bug is discovered by our own CI in #49342, so I would say we've covered the fix :)

@nicolas-grekas
Copy link
Member

Thank you @wouterj.

@nicolas-grekas nicolas-grekas merged commit 672751b into symfony:5.4 Feb 13, 2023
@wouterj wouterj deleted the debugclassloader-return-stmt-patch branch February 13, 2023 10:19
This was referenced Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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