php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72904 proc_open drops hyphenated environment variables
Submitted: 2016-08-20 00:54 UTC Modified: 2021-08-27 12:07 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: PeterJCLaw at gmail dot com Assigned:
Status: Verified Package: Program Execution
PHP Version: 7.4 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: PeterJCLaw at gmail dot com
New email:
PHP Version: OS:

 

 [2016-08-20 00:54 UTC] PeterJCLaw at gmail dot com
Description:
------------
Environment variables with hyphens in their names (e.g: `getenv('A-B')`) are lost when `proc_open` creates a child process (other process launching functions untested).

Given that these appear to be valid (they're supported by 'env' on Ubuntu) and *worked under PHP 5* this seems to be a regression.

Test script:
---------------
https://gist.github.com/PeterJCLaw/23719e515c787e70b614f45392dc21aa

Expected result:
----------------
-- SUBPROCESS START --

A-B=ZZZ
FOO=BAR
getenv("INNER"): aeiou
getenv("INNER-VAR"): aeiou
done
command returned 0

-- SUBPROCESS END --

Actual result:
--------------
-- SUBPROCESS START --

A-B=
FOO=BAR
getenv("INNER"): aeiou
getenv("INNER-VAR"): 
done
command returned 0

-- SUBPROCESS END --

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-27 12:07 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Scripting Engine problem +Package: Program Execution -PHP Version: 7.0.10 +PHP Version: 7.4
 [2021-08-27 12:07 UTC] cmb@php.net
I can confirm that behavior on Debian 9 (WSL 1) with PHP-7.4;
Windows 10 yields the expected results.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 25 08:03:33 2021 UTC