|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: bart at jdsoft dot be
New email:
PHP Version: OS:


 [2017-02-19 19:12 UTC] bart at jdsoft dot be
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  


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-19 19:16 UTC]
-Status: Open +Status: Duplicate
 [2017-02-19 19:16 UTC]
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-2023 The PHP Group
All rights reserved.
Last updated: Thu Dec 07 01:01:28 2023 UTC