|  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
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: okano1220 at gmail dot com
New email:
PHP Version: OS:


 [2011-04-24 16:15 UTC] okano1220 at gmail dot com
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:

Actual result:


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

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-06 22:06 UTC]
-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]
Thanks for reporting this issue and providing an appropriate

And sorry for the long delay!
 [2017-09-06 22:50 UTC]
Automatic comment on behalf of
Log: Fixed bug #54598 (bcpowmod() may return 1 if modulus is 1)
 [2017-09-06 22:50 UTC]
-Status: Analyzed +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 07:01:30 2024 UTC