php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75169 BCMath errors/warnings bypass PHP's error handling
Submitted: 2017-09-07 15:23 UTC Modified: 2017-09-13 14:22 UTC
From: cmb@php.net Assigned: cmb (profile)
Status: Closed Package: BC math related
PHP Version: 7.0.23 OS: *
Private report: No CVE-ID: None
 [2017-09-07 15:23 UTC] cmb@php.net
Description:
------------
BCMath reports some errors and warnings (such as "exponent too
large in raise") by directly writing to stderr[1], thereby
completely bypassing PHP's error handling.

[1] <https://github.com/php/php-src/blob/php-7.0.23/ext/bcmath/libbcmath/src/rt.c>


Test script:
---------------
<?php

set_error_handler(function ($errno, $errstr) {
    var_dump('caught');
});
bcdiv('1', '0');
bcpow('1', '12345678901234567890');


Expected result:
----------------
string(6) "caught"
string(6) "caught"


Actual result:
--------------
string(6) "caught"
bc math error: exponent too large in raise


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-13 14:21 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fd73a54c30a0851ae40a1a361ee4022236be6bcb
Log: Fixed bug #75169 (BCMath errors/warnings bypass error handling)
 [2017-09-13 14:21 UTC] cmb@php.net
-Status: Open +Status: Closed
 [2017-09-13 14:22 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC