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
 [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

Pull Requests

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: Thu Nov 21 14:01:29 2024 UTC