Bug #70742 [Opn->Nab]: random_bytes() fails when the SYSTEMROOT env var is empty
| From: | ab@php.net | Date: | Tue, 20 Oct 2015 11:16:04 +0000 |
| Subject: | Bug #70742 [Opn->Nab]: random_bytes() fails when the SYSTEMROOT env var is empty | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196703@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70742&edit=1
ID: 70742
Updated by: ab@php.net
Reported by: nicolas dot grekas+php at gmail dot com
Summary: random_bytes() fails when the SYSTEMROOT env var is
empty
-Status: Open
+Status: Not a bug
Type: Bug
Package: mcrypt related
Operating System: Windows
PHP Version: 7.0.0RC5
Block user comment: N
Private report: N
New Comment:
Thanks for the report. Why would you want to manipulate this env variable? Doing so, you'll
probably break not only this but many other things.
In this particular case, since the default crypto service provider is used, the corresponding DLL
will fail to load. Consequently CryptAcquireContext() will fail. This is expected behavior.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2015-10-19 14:56:06] nicolas dot grekas+php at gmail dot com
Description:
------------
On Windows, both random_bytes and mcrypt_create_iv fail when the SYSTEMROOT env var is not set.
Test script:
---------------
<?php
putenv('SYSTEMROOT=');
echo strlen(random_bytes(1));
Expected result:
----------------
1
Actual result:
--------------
PHP Warning: mcrypt_create_iv(): Could not gather sufficient random data
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70742&edit=1