Giter VIP home page Giter VIP logo

Comments (6)

samsonasik avatar samsonasik commented on June 16, 2024 1

Ok, reproduced in php 8.0:

➜  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
Stack trace:

from rector.

Kenneth-Sills avatar Kenneth-Sills commented on June 16, 2024 1

Wonderful, that works!

Thank you for such a quick turnaround. 😄

from rector.

samsonasik avatar samsonasik commented on June 16, 2024

Looking at the error, you don't have MHASH_XXH32 constant, I guess you have different php version between cli and web, could you create a reproducible repo? Thank you.

from rector.

Kenneth-Sills avatar Kenneth-Sills commented on June 16, 2024

Looking at the error, you don't have MHASH_XXH32 constant,

Not sure what this is, searches don't turn up anything and given it's happening in the DI layer, I assumed it was a dynamically generated name.

The WebDevops PHP Image should contain pretty much all PHP modules by default, and I don't see any special requirements listed for Rector so I'm not sure what would cause it. This also happens on production servers (Debian via Sury) and a local machine (Arch via official packages), so seems to reproduce across several real-world cases.

could you create a reproducible repo?

Of course! Here you go.

The reproductions steps are similar to the above:

git clone https://github.com/Kenneth-Sills/rector-847-reproduction
cd rector-847-reproduction
docker run --rm -it -v `pwd`:/app webdevops/php:8.0 bash
cd app
composer exec rector -- --dry-run process index.php

Let me know if you need anything else from me. 😄

from rector.

samsonasik avatar samsonasik commented on June 16, 2024

Ok, it seems the following constant need to be added:

if (PHP_VERSION_ID < 80100) {
    if (! defined('MHASH_XXH32')) {
        define('MHASH_XXH32', 38);
    }

    if (! defined('MHASH_XXH64')) {
        define('MHASH_XXH64', 39);
    }

    if (! defined('MHASH_XXH3')) {
        define('MHASH_XXH3', 40);
    }

    if (! defined('MHASH_XXH128')) {
        define('MHASH_XXH128', 41);
    }
}

from rector.

samsonasik avatar samsonasik commented on June 16, 2024

@Kenneth-Sills could you try latest rector/rector:dev-main:

composer config minimum-stability dev
composer config prefer-stable true
composer require --dev rector/rector:dev-main

and verify if it now resolved? thank you.

from rector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.