php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54598 bcpowmod() may return 1 if modulus is 1
Submitted: 2011-04-24 16:15 UTC Modified: 2017-09-06 22:06 UTC
Votes:3
Avg. Score:3.7 ± 0.9
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: okano1220 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: BC math related
PHP Version: 5.3.6 OS: linux,windows
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: okano1220 at gmail dot com
New email:
PHP Version: OS:

 

 [2011-04-24 16:15 UTC] okano1220 at gmail dot com
Description:
------------
when setting bcpowmod 2nd parameter $right_operand to 0 and setting  3rd parameter $modulous to 1, bcpowmod returns 1.

Ofcourse expected value is 0.

Test script:
---------------
<?php echo bcpomod(5,0,1); // 5**0%1

Expected result:
----------------
0

Actual result:
--------------
1

Patches

20110424bcpowmod_okano (last revision 2011-04-24 14:18 UTC by okano1220 at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-06 22:06 UTC] cmb@php.net
-Summary: when exp is 0 ,bcpowmod returns 1 ,even if modulous is 1 +Summary: bcpowmod() may return 1 if modulus is 1 -Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
 [2017-09-06 22:06 UTC] cmb@php.net
Thanks for reporting this issue and providing an appropriate
patch!

And sorry for the long delay!
 [2017-09-06 22:50 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b2919853f867ca7948e1c80c48eb868eae4ba882
Log: Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
 [2017-09-06 22:50 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 00:01:30 2024 UTC