php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74130 /dev/urandom
Submitted: 2017-02-19 19:12 UTC Modified: 2017-02-19 19:16 UTC
From: bart at jdsoft dot be Assigned:
Status: Duplicate Package: *Encryption and hash functions
PHP Version: 7.0.16 OS: Linux
Private report: No CVE-ID: None
 [2017-02-19 19:12 UTC] bart at jdsoft dot be
Description:
------------
Unable to generate a random value

Test script:
---------------
echo "<?php random_bytes(10);" | php   


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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-19 19:16 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2017-02-19 19:16 UTC] requinix@php.net
As said in the documentation, this happens on Linux if the system does not support the getrandom(2) syscall. That has been fixed with bug #74105.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC