php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71868 Environment variables with no value are filtered out by proc_open()
Submitted: 2016-03-21 14:12 UTC Modified: 2016-03-21 14:13 UTC
Votes:4
Avg. Score:3.8 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: enrico dot stahn at gmail dot com Assigned:
Status: Open Package: Program Execution
PHP Version: 5.6.19 OS: Debian
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: enrico dot stahn at gmail dot com
New email:
PHP Version: OS:

 

 [2016-03-21 14:12 UTC] enrico dot stahn at gmail dot com
Description:
------------
Empty environment variables passed to proc_open are filtered out.

Test script:
---------------
<?php
// process.php

$env = ['FOO' => 'abc', 'BAR' => ''];
$pipes = [];
$process = proc_open('./env.php', [], $pipes, `pwd`, $env);
proc_close($process);


#!/usr/bin/php
<?php
// env.php

var_dump($_SERVER['FOO']);
var_dump($_SERVER['BAR']);
php process.php will output:

string(3) "abc"
PHP Notice:  Undefined index: BAR in /Users/kuba/Projects/symfony/issues/env.php on line 6
NULL


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-21 14:13 UTC] enrico dot stahn at gmail dot com
https://github.com/symfony/symfony/issues/18170#issuecomment-199225778
 [2016-04-14 23:01 UTC] chrispmaiden at gmail dot com
I can confirm I'm able to reproduce this behaviour on both 5 and 7 branches. I've been working on a failing test which is at https://github.com/matason/php-src/commit/eab2ae391702f4287fad7c9885d45585d606464f

I'm pretty sure I have a fix for the 5 branch, I will follow up with that and a fix for the 7 branch.

Best,

Chris
 [2016-04-16 12:50 UTC] chrispmaiden at gmail dot com
I've pushed a commit to my fork which appears to fix the issue, https://github.com/matason/php-src/commit/39c546d0499470b5437e3d24d909b63f994558ec

I'd appreciate review from someone who knows the code better than I!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC