|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75810 getenv with valid varname crashes ntdll.dll
Submitted: 2018-01-12 19:12 UTC Modified: 2018-01-15 16:52 UTC
From: laurinkeithdavis at gmail dot com Assigned:
Status: Duplicate Package: PHP options/info functions
PHP Version: 7.1.13 OS: Windows 10 x64 Pro
Private report: No CVE-ID: None
 [2018-01-12 19:12 UTC] laurinkeithdavis at gmail dot com
Any specific varname, if that environment variable name actually exists, crashes PHP. If you put a non-valid environment variable name, that does not crash and no value (getenv()), dumps the whole array, and does not crash. 

Test script:
echo getenv("PATH");

Expected result:
Value of the indicated environment variable.

Actual result:
Internal Server Error 500


Log Name:      Application
Source:        Application Error
Date:          1/12/2018 12:46:03 PM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Faulting application name: php-cgi.exe, version:, time stamp: 0x5a4d3a49
Faulting module name: ntdll.dll, version: 10.0.16299.192, time stamp: 0x16e7ff7f
Exception code: 0xc0000374
Fault offset: 0x000da8b9
Faulting process id: 0x1ecc
Faulting application start time: 0x01d38bd593ca174a
Faulting application path: C:\PHP\php-cgi.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report Id: c4b5c9e2-dcb6-4f21-9b32-457689bce66a
Faulting package full name: 
Faulting package-relative application ID: 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-12 19:14 UTC] laurinkeithdavis at gmail dot com
Confirmed this does not occur in 7.1.12.
 [2018-01-12 19:36 UTC] laurinkeithdavis at gmail dot com
I'm pretty sure the change made for is the "cause", as getenv was modified, not just putenv. 

I don't know C well enough. I am trying to decipher the change that might be an issue, but no luck so far.
 [2018-01-12 20:23 UTC]
-Status: Open +Status: Feedback
 [2018-01-12 20:23 UTC]
Thanks for the report. Looks pretty much like bug #75794. What is your exact PHP. Please post your php.ini. If possible, also a crash dump.

 [2018-01-12 20:32 UTC] laurinkeithdavis at gmail dot com
Ah, I searched for the bug using 7.1.13, but didn't think about the fact that 7.2.1 was also just released. Should I move my notes to that bug?

PHP 7.1.3 - VC14 x86 Non Thread Safe (2018-Jan-04 00:43:34) (from

I tried to post my php.ini file, but I get this message when I do:

"Your comment looks like SPAM by its content. Please consider rewording."
 [2018-01-12 21:29 UTC]
You could pastebin it somewhere and just put the link, otherwise it'd be anyway too big for a comment.

 [2018-01-12 21:36 UTC] laurinkeithdavis at gmail dot com
Oh, duh. :)
 [2018-01-13 14:16 UTC]
I've pushed a fix for this issue, could you check the latest snap, please?

 [2018-01-13 17:04 UTC] laurinkeithdavis at gmail dot com
Tested this snapshot:

7.1.14-dev Revision: r05c4f72 (January 13 2018, 16:37:57)

 [2018-01-13 21:30 UTC]
-Status: Feedback +Status: Open
 [2018-01-13 21:30 UTC]
Thanks for the checks! Waiting for the feedback in other tickets yet. The fix should be available in RCs.

 [2018-01-15 16:52 UTC]
-Status: Open +Status: Duplicate
 [2018-01-15 16:52 UTC]
Same as bug #75794.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 08:03:38 2021 UTC