diff options
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | UPGRADING | 5 | ||||
-rw-r--r-- | ext/bcmath/bcmath.c | 4 | ||||
-rw-r--r-- | ext/bcmath/tests/bcmod.phpt | 4 |
4 files changed, 17 insertions, 5 deletions
@@ -2,9 +2,6 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 7.2 -- Calendar: - . Fix integer overflows (Joshua Rogers) - - Core: . Removed IS_TYPE_IMMUTABLE (it's the same as COPYABLE & !REFCOUNTED). (Dmitry) . Removed the sql.safe_mode directive. (Kalle) @@ -26,6 +23,12 @@ PHP NEWS . Raised minimum supported Windows versions to Windows 7/Server 2008 R2. (Anatol) +- BCMath: + . Fixed bug #46564 (bcmod truncates fractionals). (liborm85) + +- Calendar: + . Fix integer overflows (Joshua Rogers) + - Date: . Fixed bug #69587 (DateInterval properties and isset). (jhdxr) @@ -37,6 +37,11 @@ PHP 7.2 UPGRADE NOTES property names would become inaccessible string keys. . Minimum supported Windows versions are Windows 7/Server 2008 R2. +- BCMath: + . The bcmod() function no longer truncates fractional numbers to integers. As + such, its behavior now follows fmod() rather than the `%` operator. For + example `bcmod('4', '3.5')` now returns '0.5' instead of '1'. + - PCRE: . preg_match() and other PCRE functions now distinguish between unmatched subpatterns and empty matches by reporting NULL and "" (empty string), diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c index 300d88b86d..e8b87dceff 100644 --- a/ext/bcmath/bcmath.c +++ b/ext/bcmath/bcmath.c @@ -403,8 +403,8 @@ PHP_FUNCTION(bcmod) bc_init_num(&first); bc_init_num(&second); bc_init_num(&result); - bc_str2num(&first, ZSTR_VAL(left), 0); - bc_str2num(&second, ZSTR_VAL(right), 0); + php_str2num(&first, ZSTR_VAL(left)); + php_str2num(&second, ZSTR_VAL(right)); switch (bc_modulo(first, second, &result, 0)) { case 0: diff --git a/ext/bcmath/tests/bcmod.phpt b/ext/bcmath/tests/bcmod.phpt index 1d7be48a75..5657e02ddc 100644 --- a/ext/bcmath/tests/bcmod.phpt +++ b/ext/bcmath/tests/bcmod.phpt @@ -9,8 +9,12 @@ bcmath.scale=0 echo bcmod("11", "2"),"\n"; echo bcmod("-1", "5"),"\n"; echo bcmod("8728932001983192837219398127471", "1928372132132819737213"),"\n"; +echo bcmod("3.5", "4"),"\n"; +echo bcmod("1071", "357.5"),"\n"; ?> --EXPECT-- 1 -1 1459434331351930289678 +3.5 +356.0 |