php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74105 PHP on Linux should use /dev/urandom when getrandom is not available
Submitted: 2017-02-16 08:32 UTC Modified: 2017-02-17 17:44 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: bruno+archlinux at ahennezel dot info Assigned: nikic (profile)
Status: Closed Package: *General Issues
PHP Version: 7.1.2RC1 OS: Linux
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: bruno+archlinux at ahennezel dot info
New email:
PHP Version: OS:

 

 [2017-02-16 08:32 UTC] bruno+archlinux at ahennezel dot info
Description:
------------
When PHP is compiled on a recent kernel, it assumes that getrandom is available.
When such a PHP build is running on an older kernel, this code throws an exception.


cf. pull request 2385

Test script:
---------------
<?php 
$a = random_int(0,10);
?>

Expected result:
----------------
Fallback to /dev/urandom and return a number
Or
Exit with a more explicit error message (checking ENOSYS)


Actual result:
--------------
PHP Fatal error:  Uncaught Exception: Could not gather sufficient random data in -:2
Stack trace:
#0 -(2): random_int(0, 200)
#1 {main}
  thrown in - on line 2

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-16 08:56 UTC] requinix@php.net
-Summary: PHP hangs when getrandom is not available +Summary: PHP on Linux should use /dev/urandom when getrandom is not available -Type: Bug +Type: Feature/Change Request -Package: Reproducible crash +Package: *General Issues
 [2017-02-17 17:44 UTC] nikic@php.net
Automatic comment on behalf of dev@benjarobin.fr
Revision: http://git.php.net/?p=php-src.git;a=commit;h=513582814b0ca82d81eb6b98897d745e0f0eebf5
Log: Fixed bug #74105
 [2017-02-17 17:44 UTC] nikic@php.net
-Status: Open +Status: Closed
 [2017-02-17 17:44 UTC] nikic@php.net
-Type: Feature/Change Request +Type: Bug -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC