Skip to content
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

[Php81] Handle crash on Crypt() single arg on NullToStrictStringFuncCallArgRector #2767

Merged
merged 6 commits into from
Aug 15, 2022

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Aug 15, 2022

Given the following code:

final class CryptOneArg
{
    public function run($subject)
    {
        crypt($subject);
    }
}

It currently crash:

There was 1 error:

1) Rector\Tests\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector\NullToStrictStringFuncCallArgRectorTest::test with data set #10 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
Undefined array key 1

Fixes rectorphp/rector#7373

@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @petitj . This PR make it skipped instead.

It may need different PR for crypt() single arg transformation, but need different PR with seems require more research since we need to find the equal for transformation for pass 2nd arg that need to be generated salt.

@samsonasik
Copy link
Member Author

Only convert 1st arg is possible actually...

@samsonasik samsonasik changed the title [Php81] Skip Crypt() single arg on NullToStrictStringFuncCallArgRector [Php81] Handle Crypt() single arg on NullToStrictStringFuncCallArgRector Aug 15, 2022
@samsonasik
Copy link
Member Author

Applied to only change 1st arg, 2nd arg will need different rule to apply it.

@samsonasik
Copy link
Member Author

I added comment to the fixture for future reference:

/**
 * Crypt requires 2 args since php 5.6, when it only fill 1st arg, it will only change 1st arg
 *
 * Note: Filling 2nd arg will require different Rule to match the salt algorithm.
 */

50d58e4

@samsonasik samsonasik changed the title [Php81] Handle Crypt() single arg on NullToStrictStringFuncCallArgRector [Php81] Handle crash on Crypt() single arg on NullToStrictStringFuncCallArgRector Aug 15, 2022
@samsonasik
Copy link
Member Author

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

@TomasVotruba
Copy link
Member

Thank you 👍

@TomasVotruba TomasVotruba merged commit 933eb13 into main Aug 15, 2022
@TomasVotruba TomasVotruba deleted the skip-crypt-single-arg branch August 15, 2022 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants