php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70579 Test ext/gmp/tests/gmp_random_seed.phpt broken
Submitted: 2015-09-25 10:17 UTC Modified: 2015-12-11 19:52 UTC
From: rainer dot jung at kippdata dot de Assigned: nikic (profile)
Status: Closed Package: GNU MP related
PHP Version: 7.0.0RC3 OS:
Private report: No CVE-ID: None
 [2015-09-25 10:17 UTC] rainer dot jung at kippdata dot de
Description:
------------
The test ext/gmp/tests/gmp_random_seed.phpt assumes the same responses on every platform. That is not true. The calls to gmp_random() in that test will return different values depending on "number of bits per limb". For a 64 Bit Linux system, the results will always be the same, but e.g. for a 32 Bit Solaris Sparc the results are different (and must be). Probably also for a 32 Bit Linux system (haven't checked that part).

Possible solutions:

- Remove gmp_random() from the test
- Only check for numbers as return, or check for changes of the number between different calls to gmp_random()
- Resolve https://bugs.php.net/bug.php?id=62375 and add different tests for different limb sizes (I don't know how to do a platform specific switch in the test framework)
- Try to detect limb size from the return value of gmp_random(1) and correct arguments of other gmp_random() with a corresponding correction factor. That will not work for gmp_random() without arguments, so drop these calls.
- Use Regexp expectation values to allow all different possible values (at least for limb size 32 and 64).



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-11 18:52 UTC] nikic@php.net
Could you check if the test is still failing? Unless there is something Solaris specific about it, https://github.com/php/php-src/commit/424a26d5d436a36a91ceb8b67dccedaeee42753d should have fixed the issue.
 [2015-12-11 19:50 UTC] rainer dot jung at kippdata dot de
The test now passes (PHP 7.0.0). Thanks a bunch! I can close the issue if you like, but I guess you prefer doing it yourself.
 [2015-12-11 19:52 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC