Skip to content

[Php56][Php70] Handle infinite loop on AddDefaultValueForUndefinedVariableRector+IfToSpaceshipRector#3394

Merged
samsonasik merged 7 commits intomainfrom
infinite-loop-default-value-spaceship
Feb 20, 2023
Merged

[Php56][Php70] Handle infinite loop on AddDefaultValueForUndefinedVariableRector+IfToSpaceshipRector#3394
samsonasik merged 7 commits intomainfrom
infinite-loop-default-value-spaceship

Conversation

@samsonasik
Copy link
Copy Markdown
Member

Given th following code

class Fixture
{
    public function sortRank($a, $b)
    {
        if ($a == $b) {
            return 0;
        }

        return ($a > $b) ? -1 : 1;
    }
}

It cause crash:

Runtime:       PHP 8.1.13
Configuration: /Users/samsonasik/www/rector-src/phpunit.xml

[1]    14431 segmentation fault  vendor/bin/phpunit tests/Issues/DefaultValueSpaceShip

Ref https://getrector.com/demo/b0b4b1b4-dfd3-4034-a2c7-402b618f56d2
Fixes rectorphp/rector#7788

@samsonasik
Copy link
Copy Markdown
Member Author

Fixed 🎉 /cc @Freespacer

@samsonasik
Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 38372f2 into main Feb 20, 2023
@samsonasik samsonasik deleted the infinite-loop-default-value-spaceship branch February 20, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rector hang up with the rule IfToSpaceshipRector

1 participant