mirror of
https://github.com/php/php-src.git
synced 2025-08-20 17:34:35 +02:00
Fixed bug #75169 (BCMath errors/warnings bypass error handling)
Instead of writing warning messages to `stderr`, we employ PHP's error handling to raise `E_WARNING` even for the single case where `bc_rt_error()` has been called, since that did not actually error out. We choose to call `php_error_docref()` directly in libbcmath, since there is no upstream, and since other PHP core functionality is already used in our bundled libbcmath. Accordingly, we remove `rt.c` so it will not be accidentally used in the future. Besides adapting a few existing tests, we add new tests so that the warnings are tested at least once. We also get rid of the Windows specific tests, since the warning behavior is now supposed to be platform-agnostic.
This commit is contained in:
parent
d1e82b39e2
commit
fd73a54c30
12 changed files with 43 additions and 123 deletions
|
@ -80,21 +80,21 @@ bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)
|
|||
/* Check the base for scale digits. */
|
||||
if (power->n_scale != 0)
|
||||
{
|
||||
bc_rt_warn ("non-zero scale in base");
|
||||
php_error_docref (NULL, E_WARNING, "non-zero scale in base");
|
||||
_bc_truncate (&power);
|
||||
}
|
||||
|
||||
/* Check the exponent for scale digits. */
|
||||
if (exponent->n_scale != 0)
|
||||
{
|
||||
bc_rt_warn ("non-zero scale in exponent");
|
||||
php_error_docref (NULL, E_WARNING, "non-zero scale in exponent");
|
||||
_bc_truncate (&exponent);
|
||||
}
|
||||
|
||||
/* Check the modulus for scale digits. */
|
||||
if (modulus->n_scale != 0)
|
||||
{
|
||||
bc_rt_warn ("non-zero scale in modulus");
|
||||
php_error_docref (NULL, E_WARNING, "non-zero scale in modulus");
|
||||
_bc_truncate (&modulus);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue