php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #79530 bcpowmod never returns NULL as stated in doc
Submitted: 2020-04-27 17:01 UTC Modified: 2020-04-28 11:33 UTC
From: mail at einargangso dot no Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mail at einargangso dot no
New email:
PHP Version: OS:

 

 [2020-04-27 17:01 UTC] mail at einargangso dot no
Description:
------------
---
From manual page: https://www.php.net/manual/en/function.bcpowmod.php
---

> Returns the result as a string, or NULL if modulus is 0 or exponent is negative. 

It never returns NULL, but false.

https://3v4l.org/co5Ge


Source: https://github.com/php/php-src/blob/master/ext/bcmath/bcmath.c#L365

Test script:
---------------
<?php

// modulus is 0
assert(is_bool(bcpowmod('2', '2', '0'))); // bcpowmod -> FALSE

// exponent is negative
assert(is_bool(bcpowmod('2', '-2', '2'))); // bcpowmod -> FALSE

// Output proof
var_dump(false === bcpowmod('2', '2', '0') && false === bcpowmod('2', '2', '0'));


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-04-28 11:33 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=349720
Log: Fix #79530: bcpowmod never returns NULL as stated in doc
 [2020-04-28 11:33 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-04-28 11:33 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-04-28 11:34 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=192925f460e565084009c5f0e14d8f6af488382b
Log: Fix #79530: bcpowmod never returns NULL as stated in doc
 [2020-04-28 18:51 UTC] mumumu@php.net
Automatic comment from SVN on behalf of mumumu
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=349721
Log: Fix #79530: bcpowmod never returns NULL as stated in doc
 [2020-04-28 18:55 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=0b30928924fec3c3412a5f1261b706de249cacdf
Log: Fix #79530: bcpowmod never returns NULL as stated in doc
 [2020-12-30 11:59 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=99ae81cf7fc1c0756e7cfd13fe59dcb34e39827c
Log: Fix #79530: bcpowmod never returns NULL as stated in doc
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 11:01:34 2024 UTC