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

Enable PHP 7.2 build #116

Merged
merged 3 commits into from
Aug 5, 2018
Merged

Enable PHP 7.2 build #116

merged 3 commits into from
Aug 5, 2018

Conversation

giorgiosironi
Copy link
Owner

See #114

@giorgiosironi
Copy link
Owner Author

giorgiosironi commented Jun 4, 2018

The Mersenne Twister implementation seems to have a syntax problem:

Error: Failure evaluating code: 
$this->mt[$i] <= $this->wMask

Ah right:

PHPUnit\Framework\Error\Deprecated: assert(): Calling assert() with a string argument is deprecated

Afraid this would fail on older versions of PHP
@SkUrRiEr
Copy link
Contributor

SkUrRiEr commented Jun 4, 2018

Interestingly running the unit tests locally under PHP 7.2 on my Debian Testing box didn't show any of those failures, only the one I patched in my PR. (And running under HHVM didn't show the errors I patched in that PR either)

@giorgiosironi
Copy link
Owner Author

I think the exceptions spawn from deprecations so they may depend on the underlying PHP configuration.

Idrinth added a commit to Idrinth/eris that referenced this pull request Jul 4, 2018
replacing some configuration with annotations refs giorgiosironi#105
moving rand and mt_rand into Source-Implementations
removing unused use statements
replacing os specific tmp-dir with function calls
fixing env-setting on windows
handling int overflow for seeds on 32bit systems
adjusting documentation
Idrinth added a commit to Idrinth/eris that referenced this pull request Jul 4, 2018
replacing some configuration with annotations refs giorgiosironi#105
moving rand and mt_rand into Source-Implementations
removing unused use statements
replacing os specific tmp-dir with function calls
fixing env-setting on windows
handling int overflow for seeds on 32bit systems
adjusting documentation
Idrinth added a commit to Idrinth/eris that referenced this pull request Jul 4, 2018
replacing some configuration with annotations refs giorgiosironi#105
moving rand and mt_rand into Source-Implementations
removing unused use statements
replacing os specific tmp-dir with function calls
fixing env-setting on windows
handling int overflow for seeds on 32bit systems
adjusting documentation
@Idrinth Idrinth mentioned this pull request Jul 4, 2018
@peter279k
Copy link

peter279k commented Jul 23, 2018

The assert function is deprecated on php-7.2.
The more details are in the official PHP doc.

According to the Travis CI build log, it seems that the src/Random/MersenneTwister.php on line 54 should be modified, too.

@localheinz
Copy link
Contributor

@giorgiosironi

@peter279k is right, running

$ git grep "assert('"

on this branch yields

src/Random/MersenneTwister.php:54:        assert('$this->index <= $this->n');
src/Random/MersenneTwister.php:60:        assert('$y <= 0xffffffff');
src/Random/MersenneTwister.php:62:        assert('$y <= 0xffffffff');
src/Random/MersenneTwister.php:64:        assert('$y <= 0xffffffff');
src/Random/MersenneTwister.php:66:        assert('$y <= 0xffffffff');
src/Random/MersenneTwister.php:81:            assert('$x <= 0xffffffff');
src/Random/MersenneTwister.php:83:            assert('$xA <= 0x7fffffff');

@giorgiosironi
Copy link
Owner Author

I guess these should be replaced by https://github.com/beberlei/assert

@peter279k
Copy link

@giorgiosironi , thank you for your reply.
I think we should modify the passed argument for assert function because the assert function pass argument is changed since php-7.2.

According to the official PHP doc, the warning message for php-7.2 is as follows:

Warning
Using string as the assertion is DEPRECATED as of PHP 7.2.

I don't think it's necessary to add another Assert package to do this 👍 .

@giorgiosironi
Copy link
Owner Author

Is that backward compatible with how assert was used in the other supported versions? I'll try that out.

@giorgiosironi giorgiosironi merged commit 7287aa9 into master Aug 5, 2018
@giorgiosironi giorgiosironi deleted the php_7.2 branch August 5, 2018 21:23
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.

4 participants