Commit Graph

226 Commits

Author SHA1 Message Date
Christoph M. Becker
b152633ecb Scale support for bcmod()
As of commit 90dcbbe (PHP-7.2+) bcmod() supports non-integral
parameters as well. Since formerly only integer modulus has been
supported, it did not make much sense to cater to the scale with regard
to the result. However, now it does for consistency with other BCMath
operations.

Therefore, we add support for an optional `scale` parameter and fall
back to the default scale (`bcmath.scale`) as usual.
2017-11-06 17:26:52 -05:00
Christoph M. Becker
77f3cef35c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #46781 (BC math handles minus zero incorrectly)
2017-09-11 23:52:14 +02:00
Christoph M. Becker
87a91aef83 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #46781 (BC math handles minus zero incorrectly)
2017-09-11 23:46:21 +02:00
Christoph M. Becker
9aa6898b9b Fixed bug #46781 (BC math handles minus zero incorrectly)
Actually, there is no negative zero at all.  We obey Postel's law, and
still accept negative zeroes, but we store them as positive zeroes
after the conversion from string, i.e. we normalize before further
processing.
2017-09-11 23:44:23 +02:00
Christoph M. Becker
20fe838c76 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug75178.phpt on Windows
2017-09-09 17:04:42 +02:00
Christoph M. Becker
6602cc0385 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug75178.phpt on Windows
2017-09-09 16:54:23 +02:00
Christoph M. Becker
3fd08a1595 Fix bug75178.phpt on Windows
bug75178.phpt fails on Windows, because the stderr output is not
interspersed with stdout output there, but rather is appended to the
end. The fix is analogous to bug72093.phpt.
2017-09-09 16:46:32 +02:00
Christoph M. Becker
21eab49a53 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
2017-09-09 13:30:40 +02:00
Christoph M. Becker
afa39038c2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
2017-09-09 13:20:14 +02:00
Christoph M. Becker
44eec946e8 Fixed bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
Since `bcpowmod()` does not support non-integral operands, we have to
truncate these in addition to emitting a respective warning. We also
have to work with the truncated values in the following.

We recognize that the division by one to enforce the truncation is
actually overkill, but we stick with it for now, and shall tackle the
issue for PHP 7.3.
2017-09-09 13:18:26 +02:00
Christoph M. Becker
d01453b129 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
2017-09-07 00:38:59 +02:00
Christoph M. Becker
0f88a49fd5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
2017-09-07 00:32:39 +02:00
Christoph M. Becker
b2919853f8 Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
`x mod 1` is always zero; we have to take the scale into account,
though.
2017-09-07 00:30:05 +02:00
Christoph M. Becker
5ce744091c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #44995 (bcpowmod() fails if scale != 0)
2017-09-06 23:41:46 +02:00
Christoph M. Becker
d724d8c107 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #44995 (bcpowmod() fails if scale != 0)
2017-09-06 23:33:48 +02:00
Christoph M. Becker
dea41f3c3a Fixed bug #44995 (bcpowmod() fails if scale != 0)
`bc_divmod()` is supposed to do integer division, so we must not apply
a scale factor here.
2017-09-06 23:30:53 +02:00
Xinchen Hui
696bd37e67 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed condition check
  Fixed condition check
  another place

Conflicts:
	ext/mcrypt/mcrypt.c
2017-04-10 14:49:13 +08:00
Xinchen Hui
65d77812fc Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed condition check
2017-04-10 14:47:42 +08:00
Xinchen Hui
4bebcb84ad Fixed condition check 2017-04-10 14:47:24 +08:00
Edgar R. Sandi
0608761438 Increased bcmath functions coverage tests using scale option parameter 2017-03-27 18:48:58 +02:00
Thomas Punt
9d9defa29a Remove dead code from BCMath extension 2017-03-16 12:23:55 +01:00
Nikita Popov
edcabf6d07 Drop unnecessary allocator return value checks 2017-03-13 22:07:15 +01:00
Brian Evans
2fe9208ee3
Use modern autotools name of configure.ac instead of configure.in
configure.ac was introduced in 2001 with automake-1.15 and autoconf-2.50
to replace the file named configure.in.
Autotools is preparing to remove configure.in in Automake 2.0.
All new software should be using configure.ac.
This also fixes Bug #69770 where extensions are creating configure.in

Signed-off-by: Brian Evans <grknight@gentoo.org>
2017-01-27 06:07:40 +00:00
Libor M
90dcbbe3cb Fixed bug #46564
bcmod() no longer truncates fractionals to integers. This matches
the behavior of fmod(). It also matches the behavior of bcpowmod().
It also matches the behavior of bcmod() in HHVM.
2017-01-07 19:10:31 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Sara Golemon
fbec1a7b10 Convert bcmath to new parameter parsing API 2016-12-27 23:49:48 -08:00
Sara Golemon
b1300e4933 Use zend_string in bcmath params 2016-12-27 23:35:38 -08:00
Remi Collet
aecd165b8f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  use zend_error instead of zend_error_noreturn
2016-10-14 10:54:47 +02:00
Remi Collet
428ef50838 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  use zend_error instead of zend_error_noreturn
2016-10-14 10:54:09 +02:00
Remi Collet
e1f5b6d8df use zend_error instead of zend_error_noreturn 2016-10-14 10:53:40 +02:00
Anatol Belski
a8a11b669d Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #73190: memcpy negative parameter _bc_new_num_ex

(cherry picked from commit af1bf873fe)
2016-10-14 01:46:18 +02:00
Stanislav Malyshev
74b5662536 Fix bug #73190: memcpy negative parameter _bc_new_num_ex
(cherry picked from commit 40e7baab3c)
2016-10-12 19:48:25 +02:00
Stanislav Malyshev
40e7baab3c Fix bug #73190: memcpy negative parameter _bc_new_num_ex 2016-10-03 00:09:02 -07:00
Anatol Belski
8a8a441972 fix clang compat 2016-08-27 22:25:02 +02:00
Anatol Belski
25ef19f927 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix/improve tests
2016-04-27 13:19:29 +02:00
Anatol Belski
a21a997478 fix/improve tests 2016-04-27 13:16:57 +02:00
Anatol Belski
4bc97db0b8 fix merge 2016-04-27 12:24:28 +02:00
Anatol Belski
33d41da347 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix memory leak
  Fix bug #72099: xml_parse_into_struct segmentation fault
  5.5.36 now
  Fix bug #72094 - Out of bounds heap read access in exif header processing
  Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definition
  Fix bug #72061 - Out-of-bounds reads in zif_grapheme_stripos with negative offset
  Fix for bug #71912 (libgd: signedness vulnerability)
  Typo in NEWS
2016-04-27 11:45:29 +02:00
Stanislav Malyshev
e315a162da Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix memory leak
  Fix bug #72099: xml_parse_into_struct segmentation fault
  5.5.36 now
  Fix bug #72094 - Out of bounds heap read access in exif header processing
  Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definition
  Fix bug #72061 - Out-of-bounds reads in zif_grapheme_stripos with negative offset
  Fix for bug #71912 (libgd: signedness vulnerability)
  Typo in NEWS

Conflicts:
	configure.in
	main/php_version.h
2016-04-26 23:48:41 -07:00
Stanislav Malyshev
d650063a04 Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definition
We can not modify result since it can be copy of _zero_ or _one_, etc. and
"copy" in bcmath is just bumping the refcount.
2016-04-24 18:33:32 -07:00
Nikita Popov
1ac152938c Move semicolon into TSRMLS_CACHE_EXTERN/DEFINE
Also re bug #71575.
2016-03-03 16:50:01 +01:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Anatol Belski
4e66cce87c switch to the unified globals accessor where appropriate 2015-07-29 13:26:35 +02:00
Dmitry Stogov
4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00
Anatol Belski
ec89c85054 cleaning up the version macros 2015-03-23 20:13:59 +01:00
Anatol Belski
af3ca74501 made ZEND_TSRMLS_CACHE_* macros look like function calls
which also comply with the current semantics for such macros
2015-02-16 17:19:32 +01:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00