php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69349 Default value of $scale parameter wrong
Submitted: 2015-04-01 17:38 UTC Modified: 2015-12-20 00:03 UTC
From: cmb@php.net Assigned: tpunt (profile)
Status: Closed Package: BC math related
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cmb@php.net
New email:
PHP Version: OS:

 

 [2015-04-01 17:38 UTC] cmb@php.net
Description:
------------
---
From manual page: http://www.php.net/function.bcdiv
---
Part of the function signature is:

  [, int $scale = int ]
  
That doesn't make much sense. The default is 0 or whatever has been
set with bcscale().


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-01 17:44 UTC] cmb@php.net
bccomp(), bcmul(), bcpowmod() and bcsub() have the same issue.

Furthermore some of the BC Math functions specify:

  string $left_operand = "" , string $right_operand = ""
  
It doesn't seem to make much sense to give a default for a
mandatory parameter.
 [2015-04-01 19:37 UTC] sobak@php.net
Automatic comment from SVN on behalf of sobak
Revision: http://svn.php.net/viewvc/?view=revision&revision=336318
Log: Mandatory parameters don't have default values

(partially fixes #69349)
 [2015-12-20 00:00 UTC] tpunt@php.net
-Assigned To: +Assigned To: tpunt
 [2015-12-20 00:00 UTC] tpunt@php.net
Automatic comment from SVN on behalf of tpunt
Revision: http://svn.php.net/viewvc/?view=revision&revision=338333
Log: Resolve doc bug #69349
 [2015-12-20 00:03 UTC] tpunt@php.net
I've resolved this with commit: https://svn.php.net/viewvc?view=revision&revision=338333

It sets the default parameter for scale to 0 for the mentioned functions and updates the scale parameter description (&bc.scale.description;) to say that it firstly defaults to the value set by bcscale(), and then falls back to 0 if that isn't set.
 [2015-12-20 00:03 UTC] tpunt@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 12:01:32 2024 UTC