Skip to content

1.17.1 introduced error with possible undefined #3553

@momala454

Description

@momala454

Describe the bug
In the following code it says $a is possibly undefined, but I also define it in the catch, so it is always defined. It seems to trigger only if I have "finally"

To Reproduce

$abc = 'abc';
        try {
            json_decode($abc, flags: JSON_THROW_ON_ERROR);
            $a = 1;
        } catch (\Throwable $e) {
            $a = 2;
        } finally {
            echo 'bla';
        }
        echo $a;

Expected behavior
No error

Screenshots

Image

Platform and version
OS and Intelephense version.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions