ABLincoln icon indicating copy to clipboard operation
ABLincoln copied to clipboard

Modulo operation breaks on 32 bit php

Open wizardishungry opened this issue 10 years ago • 4 comments

PHPunit fails as the array subscripts are negative numbers when using 32 bit integers and modulo

wizardishungry avatar Nov 09 '15 20:11 wizardishungry

  1. NamespaceTest::testVanillaNamespace Undefined offset: -742

/home/jwilliams/ABLincoln/src/Vimeo/ABLincoln/Operators/Random/Sample.php:50 /home/jwilliams/ABLincoln/src/Vimeo/ABLincoln/Operators/AbstractSimpleOperator.php:44 /home/jwilliams/ABLincoln/src/Vimeo/ABLincoln/Assignment.php:122 /home/jwilliams/ABLincoln/src/Vimeo/ABLincoln/Namespaces/SimpleNamespace.php:125 /home/jwilliams/ABLincoln/tests/NamespaceTest.php:45 /home/jwilliams/ABLincoln/src/Vimeo/ABLincoln/Namespaces/SimpleNamespace.php:54 /home/jwilliams/ABLincoln/tests/NamespaceTest.php:22

wizardishungry avatar Nov 09 '15 20:11 wizardishungry

I did a quick test replacing % with bcmod() – the negative array indexes no longer occur, however the tests still fail.

wizardishungry avatar Nov 09 '15 20:11 wizardishungry

PHP 5.6.14-1+deb.sury.org~precise+1 (cli) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

wizardishungry avatar Nov 09 '15 20:11 wizardishungry

Thanks for the heads up - it looks like we should require 64 bit for now until we find a way to make this 32 bit compatible.

akalicki avatar Nov 24 '15 06:11 akalicki