php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74346 proc_open reference to return value
Submitted: 2017-03-30 23:09 UTC Modified: 2018-08-10 15:55 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: marco dot agnoli at me dot com Assigned: cmb (profile)
Status: Wont fix Package: Program Execution
PHP Version: 5.6.30 OS: OS X 10.11.6
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-03-30 23:09 UTC] marco dot agnoli at me dot com
Description:
------------
proc_open returns immediately when a reference to the returned resource is made.

PHP 7.x shows the expected behaviour.

Test script:
---------------
<?php

$spec = [
	0 => STDIN,
	1 => STDOUT,
	2 => STDERR
];

$pipes = [];

echo 'Starting'.PHP_EOL;

$proc = proc_open('sleep 3 ; echo "Hi"', $spec, $pipes);

if (!is_resource($proc)) exit(1);

$ref = &$proc;

// Should wait but does not wait
proc_close($proc);

echo 'Done'.PHP_EOL;


Expected result:
----------------
Starting
Hi (after 3 seconds)
Done

Actual result:
--------------
Starting
Done
Hi (after 3 seconds)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-30 23:11 UTC] marco dot agnoli at me dot com
Made a typo:

* proc_close (NOT proc_open) returns immediately when a reference to the returned resource is made.
 [2017-03-30 23:24 UTC] marco dot agnoli at me dot com
Just realized that I passed the second parameter ($descriptorspec) wrong.

Still shows the same behaviour though.
 [2018-08-10 15:55 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2018-08-10 15:55 UTC] cmb@php.net
Active support for PHP 5.6 ended on 19 Jan 2017[1], so this won't
be fixed.

[1] <http://php.net/supported-versions.php>
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 23 04:03:37 2021 UTC