On 7/16/25 13:56, Ayesh Karunaratne wrote:
Would adding a bcgetopts(): int and a bcsetopts(int $opts): void calls
be useful?
At this time there's no way to influence bcmath's behavior other than
bcscale().
How about adding these as methods/properties to the `BcMath\Number` class?
`BcMath\Number` does not use the `bcmath.scale` INI directive, and in
my opinion, it is the correct way to do it. Everything that affects
the operations are just there in the code, and there is no hidden
global state.
That would also totally work. Anything that would allow sanitizing the
string directly in the extension as opposed to doing it in PHP would be
a great progress.
I would vouch for the sanitization switch to be a global state setting
such as the bcscale, as opposed to (only) be a callable method/function.
This way, we would avoid an extra call from PHP for sanitization.