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

Fix undefined MHASH_* constant on running downgrade from php 8.0 #5585

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

samsonasik
Copy link
Member

@Kenneth-Sills looking at the laravel, it seems the MHASH_* is included magically there, so this is to ensure the constants exists on php 8.0

Fixes rectorphp/rector#8471

@samsonasik samsonasik enabled auto-merge (squash) February 8, 2024 05:36
@samsonasik
Copy link
Member Author

samsonasik commented Feb 8, 2024

Before

➜  rector-847-reproduction git:(main) ✗ php80 vendor/bin/rector process index.php --dry-run
PHP Fatal error:  Uncaught Error: Undefined constant "MHASH_XXH32" in /Users/samsonasik/www/rector-847-reproduction/vendor/rector/rector/vendor/illuminate/container/Container.php:818

After

➜  rector-847-reproduction git:(main) ✗ php80 vendor/bin/rector process index.php --dry-run
 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
1 file with changes
===================

1) index.php:0

    ---------- begin diff ----------
@@ @@
 <?php

-echo str_starts_with('a', 'a');
+echo strncmp('a', 'a', strlen('a')) === 0;
    ----------- end diff -----------

@samsonasik samsonasik merged commit 2aa1c38 into main Feb 8, 2024
41 checks passed
@samsonasik samsonasik deleted the php80-missing-constant branch February 8, 2024 05:37
@samsonasik
Copy link
Member Author

@TomasVotruba I am merging it to have faster feedback to test ;)

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.

DowngradeLevelSetList to PHP <8.1 in Rector Versions >0.18.5 Cannot Be Run On PHP Versions <8.1
1 participant