note 97379 added to function.proc-open

From: Date: Fri, 16 Apr 2010 18:32:28 +0000
Subject: note 97379 added to function.proc-open
Groups: php.notes 
Request: Send a blank email to php-notes+get-168327@lists.php.net to get a copy of this message
Interestingly enough, it seems you actually have to store the return value in order for your streams to exist. You can't throw it away. In other words, this works: <?php $proc=proc_open("echo foo", array( array("pipe","r"), array("pipe","w"), array("pipe","w") ), $pipes); print stream_get_contents($pipes[1]); ?> prints: foo but this doesn't work: <?php proc_open("echo foo", array( array("pipe","r"), array("pipe","w"), array("pipe","w") ), $pipes); print stream_get_contents($pipes[1]); ?> outputs: Warning: stream_get_contents(): <n> is not a valid stream resource in Command line code on line 1 The only difference is that in the second case we don't save the output of proc_open to a variable. ---- Server IP: 69.147.83.197 Probable Submitter: 174.46.204.210 ---- Manual Page -- http://www.php.net/manual/en/function.proc-open.php Edit -- https://master.php.net/note/edit/97379 Del: integrated -- https://master.php.net/note/delete/97379/integrated Del: useless -- https://master.php.net/note/delete/97379/useless Del: bad code -- https://master.php.net/note/delete/97379/bad+code Del: spam -- https://master.php.net/note/delete/97379/spam Del: non-english -- https://master.php.net/note/delete/97379/non-english Del: in docs -- https://master.php.net/note/delete/97379/in+docs Del: other reasons-- https://master.php.net/note/delete/97379 Reject -- https://master.php.net/note/reject/97379 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168327) next »