Bug #74346 [Opn]: proc_open reference to return value

[email protected] ("marco dot agnoli at me dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=74346&edit=1

 ID:                 74346
 User updated by:    marco dot agnoli at me dot com
 Reported by:        marco dot agnoli at me dot com
 Summary:            proc_open reference to return value
 Status:             Open
 Type:               Bug
 Package:            Program Execution
 Operating System:   OS X 10.11.6
 PHP Version:        5.6.30
 Block user comment: N
 Private report:     N

 New Comment:

Made a typo:

* proc_close (NOT proc_open) returns immediately when a reference to the returned resource is made.


Previous Comments:
------------------------------------------------------------------------
[2017-03-30 23:09:24] 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)


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74346&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.