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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 - 13 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC