web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.16k stars 543 forks source link

Support PHP 8.0 #257

Closed miguilimzero closed 2 years ago

miguilimzero commented 2 years ago

This pull request add support for PHP 8.0 and bumps minimum version for package to 7.2 (instead of 7.1).

The wrong preg_match with this test that broke the tests to PHP 8.0. The phpseclib returns empty when sending an invalid hexadecimal string using PHP 7 (making the old test pass), but for PHP 8 it throws an exception (since the correct behavior is to send only hexadecimal strings).

sc0Vu commented 2 years ago

Thanks, it works on php8.0.

miguilimzero commented 2 years ago

@sc0Vu The tests were supposed to be passing. But in the "Cache composer packages" step it is fetching a cache of an incorrect composer.lock file.

The cache key is not taking into account the version of PHP being run in the test. I will add a commit that fixes this.

Explanation: For PHP 7.x the guzzlehttp/guzzle requires symfony/deprecation-contracts in version ^2.2.

For PHP 8.x the guzzlehttp/guzzle requires symfony/deprecation-contracts in version ^3.0.

The test was getting a cached version of composer.lock that was generated by PHP 8, that locked symfony/deprecation-contracts to version ^3.0, which consequently doesn't work in PHP 7.x.