Req #74105 [Opn->Csd]: PHP on Linux should use /dev/urandom when getrandom is not available
| From: | nikic@php.net | Date: | Fri, 17 Feb 2017 17:44:28 +0000 |
| Subject: | Req #74105 [Opn->Csd]: PHP on Linux should use /dev/urandom when getrandom is not available | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207434@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74105&edit=1
ID: 74105
Updated by: nikic@php.net
Reported by: bruno+archlinux at ahennezel dot info
Summary: PHP on Linux should use /dev/urandom when getrandom
is not available
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: *General Issues
Operating System: Linux
PHP Version: 7.1.2RC1
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2017-02-16 08:32:08] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74105&edit=1