summaryrefslogtreecommitdiff
path: root/ext/bcmath/bcmath.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace zend_bool uses with boolNikita Popov2021-01-151-10/+10
| | | | | | | We're starting to see a mix between uses of zend_bool and bool. Replace all usages with the standard bool type everywhere. Of course, zend_bool is retained as an alias.
* Fixed bug #80545Jens de Nies2021-01-121-53/+144
| | | | | | | | This converts the remaining "non well-formed" warnings in bcmath to ValueErrors, in line with the other warning promotions that have been performed in this extension. Closes GH-80545.
* Update bcmath.scale when calling bcscale()Nikita Popov2020-10-211-1/+5
| | | | | | | | | We should keep the value of bcmath.scale and the internal bc_precision global synchronized. Probably more important than the ability to retrieve bcmath.scale via ini_get(), this also makes sure that the set scale does not leak into the next request, as it currently does.
* Promote some warnings in BCMath to ErrorsGeorge Peter Banyard2020-09-111-11/+3
| | | | | | Also do a bit of refactoring at the same time. Closes GH-6105
* Remove proto comments from C filesMax Semenik2020-07-061-30/+15
| | | | Closes GH-5758
* make bcpowmod stricter by not returning false, instead throw exceptionVladyslav Startsev2020-06-221-4/+10
| | | | Closes GH-5747
* Fix [-Wundef] warning in BCMath extensionGeorge Peter Banyard2020-05-161-1/+1
|
* Convert UNKNOWN default values to null in ext/bcmathMáté Kocsis2020-05-021-71/+88
|
* Ensure bcmath scale is between 0 and INT_MAXVladyslav Startsev2020-04-271-27/+85
| | | | | | | | Make sure bcmatch scale is between 0 and INT_MAX, both for the ini setting, and all the functions accepting a scale argument. A ValueError is thrown if a function argument is out of range. Closes GH-5455.
* Generate function entries from stubs for a couple of extensionsMáté Kocsis2020-04-041-15/+1
| | | | Closes GH-5347
* Elevate warnings to Error Exceptions in ext/bcmathChristoph M. Becker2019-10-281-3/+4
| | | | | | `bcdiv()` and `bcmod()` throw DivisionByZeroError if the divisor is 0, which matches the behavior of the `/` and `%` operators, and `bcsqrt()` throws ValueError for negative operands.
* Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-251-2/+0
| | | | Closes GH-4732.
* Add BCMath PHP stubsSimon Podlipsky2019-08-101-65/+5
| | | | Closes GH-4508.
* Add return type for bcmath extension functionsGabriel Caruso2019-06-011-9/+9
| | | | Except for bcpowmod, as it returns string|false
* Warn about non well-formed arguments in bcmathvladyslavstartsev2019-05-141-4/+12
| | | | | Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com> Co-Authored-By: Christoph M. Becker <cmbecker69@gmx.de>
* Remove local variablesPeter Kokot2019-02-031-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the so called local variables defined per file basis for certain editors to properly show tab width, and similar settings. These are mainly used by Vim and Emacs editors yet with recent changes the once working definitions don't work anymore in Vim without custom plugins or additional configuration. Neither are these settings synced across the PHP code base. A simpler and better approach is EditorConfig and fixing code using some code style fixing tools in the future instead. This patch also removes the so called modelines for Vim. Modelines allow Vim editor specifically to set some editor configuration such as syntax highlighting, indentation style and tab width to be set in the first line or the last 5 lines per file basis. Since the php test files have syntax highlighting already set in most editors properly and EditorConfig takes care of the indentation settings, this patch removes these as well for the Vim 6.0 and newer versions. With the removal of local variables for certain editors such as Emacs and Vim, the footer is also probably not needed anymore when creating extensions using ext_skel.php script. Additionally, Vim modelines for setting php syntax and some editor settings has been removed from some *.phpt files. All these are mostly not relevant for phpt files neither work properly in the middle of the file.
* Remove yearly range from copyright noticeZeev Suraski2019-01-301-1/+1
|
* Future-proof email addresses...Zeev Suraski2018-11-011-1/+1
|
* Fix some misspellingsGabriel Caruso2018-08-121-1/+1
|
* Remove unused Git attributes identPeter Kokot2018-07-251-2/+0
| | | | | | | | | | | | | | | The $Id$ keywords were used in Subversion where they can be substituted with filename, last revision number change, last changed date, and last user who changed it. In Git this functionality is different and can be done with Git attribute ident. These need to be defined manually for each file in the .gitattributes file and are afterwards replaced with 40-character hexadecimal blob object name which is based only on the particular file contents. This patch simplifies handling of $Id$ keywords by removing them since they are not used anymore.
* year++Xinchen Hui2018-01-021-1/+1
|
* Move constants into read-only data segmentDmitry Stogov2017-12-141-1/+1
|
* Don't reintroduce split_bc_num()Christoph M. Becker2017-11-071-20/+1
| | | | | | | | | | This function has been removed in 870ed5106d6274905b5aa4341429deef12c92e55, because it is not necessary to manipulate the `bc_num` itself; instead we simply omit extraneous decimals when converting the number to string. This resolves the issue introduced by 24fd49fbabc7c5ad941095f33d05fe2e41ff667d in a cleaner way than 121d193514cbf59450a7dee0ad2e883101cbe9dd.
* Fixed build (missing function borrowed from PHP-7.2)Dmitry Stogov2017-11-071-0/+15
|
* Merge branch 'PHP-7.2'Sara Golemon2017-11-061-4/+17
|\ | | | | | | | | * PHP-7.2: Scale support for bcmod()
| * Scale support for bcmod()Christoph M. Becker2017-11-061-4/+17
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'pull-request/2742'Christoph M. Becker2017-09-181-54/+7
|\ \ | | | | | | | | | | | | * pull-request/2742: Fixed bug #66364 (BCMath bcmul ignores scale parameter)
| * | Fixed bug #66364 (BCMath bcmul ignores scale parameter)Christoph M. Becker2017-09-081-54/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | We change `bcmul()` and `bcpow()` so that the result has exactly the requested scale (i.e. decimal places) to make them consistent with the other BCMath functions. This also changes our stance regarding bug #52748, which had been classified as documentation problem. We do not manipulate the numbers themselves (anymore), but rather introduce `bc_num2str_ex()` which accepts a scale parameter that overrides the scale of the number by omitting extraneous decimals and adding zeros, respectively. This also allows us to get rid of `split_bc_num()`, which fixes bug #75164 as well.
* | Fix proto and indentationChristoph M. Becker2017-09-061-2/+2
| |
* | Fix arginfoChristoph M. Becker2017-09-061-1/+1
| | | | | | | | The `scale` parameter is now optional.
* | Merge branch 'pull-request/778' into bcscale-return-old-valueChristoph M. Becker2017-09-061-3/+8
|\ \ | |/ |/|
| * Return old scale value from bcscale()Chris Wright2014-08-181-5/+9
| | | | | | | | Fix for #67855
* | Fixed bug #46564Libor M2017-01-071-2/+2
| | | | | | | | | | | | 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.
* | Update copyright headers to 2017Sammy Kaye Powers2017-01-021-1/+1
| |
* | Convert bcmath to new parameter parsing APISara Golemon2016-12-271-44/+69
| |
* | Use zend_string in bcmath paramsSara Golemon2016-12-271-45/+36
| |
* | fix mergeAnatol Belski2016-04-271-2/+3
| |
* | Merge branch 'PHP-5.6' into PHP-7.0Anatol Belski2016-04-271-0/+21
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * \ Merge branch 'PHP-5.5' into PHP-5.6Stanislav Malyshev2016-04-261-19/+41
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | * | Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definitionStanislav Malyshev2016-04-241-19/+41
| | | | | | | | | | | | | | | | | | | | We can not modify result since it can be copy of _zero_ or _one_, etc. and "copy" in bcmath is just bumping the refcount.
| | * | Bump yearXinchen Hui2015-01-151-1/+1
| | | |
| | * | Bump yearXinchen Hui2014-01-031-1/+1
| | | |
* | | | Move semicolon into TSRMLS_CACHE_EXTERN/DEFINENikita Popov2016-03-031-1/+1
| | | | | | | | | | | | | | | | Also re bug #71575.
* | | | Merge branch 'PHP-5.6' into PHP-7.0Lior Kaplan2016-01-011-1/+1
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-5.6: Happy new year (Update copyright to 2016)
| * | | Happy new year (Update copyright to 2016)Lior Kaplan2016-01-011-1/+1
| | | |
| * | | bump yearXinchen Hui2015-01-151-1/+1
| | | |
* | | | cleaning up the version macrosAnatol Belski2015-03-231-1/+1
| | | |
* | | | made ZEND_TSRMLS_CACHE_* macros look like function callsAnatol Belski2015-02-161-2/+2
| | | | | | | | | | | | | | | | which also comply with the current semantics for such macros
* | | | bump yearXinchen Hui2015-01-151-1/+1
| | | |
* | | | trailing whitespace removalStanislav Malyshev2015-01-101-17/+17
| | | |