|  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: Assigned: cmb (profile)
Status: Closed Package: BC math related
PHP Version: 7.0.23 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
2 + 31 = ?
Subscribe to this entry?

 [2017-09-07 15:23 UTC]
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] <>

Test script:

set_error_handler(function ($errno, $errstr) {
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


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-13 14:21 UTC]
Automatic comment on behalf of
Log: Fixed bug #75169 (BCMath errors/warnings bypass error handling)
 [2017-09-13 14:21 UTC]
-Status: Open +Status: Closed
 [2017-09-13 14:22 UTC]
-Assigned To: +Assigned To: cmb
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 19 11:01:30 2019 UTC