php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62068 Test bug - gmp_nextprime and 022
Submitted: 2012-05-18 21:37 UTC Modified: 2012-05-21 10:41 UTC
From: mattficken@php.net Assigned: ab (profile)
Status: Closed Package: GNU MP related
PHP Version: 5.4.4RC1 OS: 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: mattficken@php.net
New email:
PHP Version: OS:

 

 [2012-05-18 21:37 UTC] mattficken@php.net
Description:
------------
On Windows, the gmp extension uses MPIR 1.3.1, forked from GMP 4.2.1.

The unexpected values are returned by gmp_nextprime() and gmp_gcdext().

Both the values are produced by the corresponding MPIR functions. The problem is 
not in the gmp extension.

These are behavior differences between MPIR and GMP. The next prime number 
(gmp_nextprime) from -1000 is expected to be 2, but could be -997 depending on 
the definition of prime numbers (can primes be negative?).

A newer version of MPIR may fix this problem, however we can't upgrade to it due 
to license issues. 

This may get worked out eventually. For now, we've decided to fork the affected 
tests into Windows/MPIR specific tests.

The attached patch fixes this issue.



Actual result:
--------------
003+ string(4) "-997"
003- string(1) "-2"

Patches

gmp.patch.txt (last revision 2012-05-18 21:37 UTC by mattficken)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-21 10:39 UTC] ab@php.net
Automatic comment on behalf of mattficken
Revision: http://git.php.net/?p=php-src.git;a=commit;h=645d65f3e30788c0f7d88e753d90234867622a01
Log: Fixed bug #62068 Test bug - gmp_nextprime and 022
 [2012-05-21 10:41 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2012-05-21 10:41 UTC] ab@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2014-10-07 23:25 UTC] stas@php.net
Automatic comment on behalf of mattficken
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=645d65f3e30788c0f7d88e753d90234867622a01
Log: Fixed bug #62068 Test bug - gmp_nextprime and 022
 [2014-10-07 23:36 UTC] stas@php.net
Automatic comment on behalf of mattficken
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=645d65f3e30788c0f7d88e753d90234867622a01
Log: Fixed bug #62068 Test bug - gmp_nextprime and 022
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC