php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67855 No way to get current scale in use
Submitted: 2014-08-18 12:24 UTC Modified: 2017-09-13 14:06 UTC
From: daverandom@php.net Assigned: cmb (profile)
Status: Closed Package: BC math related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
 [2014-08-18 12:24 UTC] daverandom@php.net
Description:
------------
It's possible to change the scale in use for bcmath functions using bcscale(), but it's not possible to retrieve the current value.

ini_get() only returns the default value from php.ini (as it should).

Suggested fix would be to make the argument to bcscale() optional, and have it return the old value.

Test script:
---------------
var_dump(ini_get('bcmath.scale'));
var_dump(bcscale(4));
var_dump(ini_get('bcmath.scale'));
var_dump(bcscale());


Expected result:
----------------
string(1) "0"
int(0)
string(1) "0"
int(4)


Actual result:
--------------
string(1) "0"
bool(true)
string(1) "0"

Warning: bcscale() expects exactly 1 parameter, 0 given in /in/UPp6D on line 6
NULL

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-08-18 13:05 UTC] daverandom@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: daverandom
 [2017-09-13 14:06 UTC] cmb@php.net
-Status: Assigned +Status: Closed -Assigned To: daverandom +Assigned To: cmb
 [2017-09-13 14:06 UTC] cmb@php.net
PR #2739 has been merged, so this feature will be available as of
PHP 7.3.0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 08:01:27 2024 UTC