-
Notifications
You must be signed in to change notification settings - Fork 50
Compatibility with PHP 8.1 #74
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
Conversation
Hello, could you please change the base of the PR to the Thank you. |
@szymach done |
Hello, /**
* @param GdImage|resource $image
* @param array $points
* @param int $numPoints
* @param int $color
* @return void
*/
protected function imageFilledPolygonWrapper(
$image,
array $points,
$numPoints,
$color
) {
if (version_compare(PHP_VERSION, '8.1.0') === -1) {
imagefilledpolygon($image, $points, $numPoints, $color);
} else {
imagefilledpolygon($image, $points, $color);
}
} It should go in the |
@szymach done. Seems tests are passing again :-) |
@@ -516,7 +516,7 @@ public function modulo($Value1, $Value2) | |||
$Factor = $Factor * 10; | |||
} | |||
|
|||
return ($Value1 * $Factor) % ($Value2 * $Factor); | |||
return floor($Value1 * $Factor) % floor($Value2 * $Factor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please tell me how do the values here change after adding these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They actually shouldn't change at all. The floor is, what PHP will do in background. The modulo operation (%
) works with integers only. And when casting a float to integer PHP simply cuts off the fraction digits.
See this for a simple demonstration: https://3v4l.org/EehJN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR.
fixes #69
fixes #68