php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80545 bcadd('a', 'a') doesn't throw an exception
Submitted: 2020-12-22 15:22 UTC Modified: -
From: terrafrost@php.net Assigned:
Status: Closed Package: BC math related
PHP Version: 8.0.0 OS: any
Private report: No CVE-ID: None
 [2020-12-22 15:22 UTC] terrafrost@php.net
Description:
------------
PHP 8.0.0 made it so that the bcmath functions (among others) "throw an Error exception if the validation of the parameters fails" but there's one condition in which a warning will still be triggered (as opposed to an exception being thrown).

Test script:
---------------
<?php
bcadd('a', 'a');

Expected result:
----------------
throw new TypeError('bcadd(): Argument #1 ($num1) must be numeric'); or some such

Actual result:
--------------
trigger_error('bcadd: bcmath function argument is not well-formed', E_USER_WARNING);

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-27 21:42 UTC] j dot de dot nies at protonmail dot com
The following pull request has been associated:

Patch Name: Bug #80545: Converted some type warnings to type errors in the "bcmath" extension.
On GitHub:  https://github.com/php/php-src/pull/6545
Patch:      https://github.com/php/php-src/pull/6545.patch
 [2021-01-09 11:40 UTC] arozkova676 at gmail dot com
Thanks for sharing the information.



https://www.igarageband.net/
 [2021-01-12 08:51 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2021-01-12 08:51 UTC] nikic@php.net
Automatic comment on behalf of j.de.nies@protonmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=94a151a018d150ff6470fc35bc509f1bd8e3956a
Log: Fixed bug #80545
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Feb 25 20:01:24 2021 UTC