Bug #68668 [Opn->Nab]: popen does not pass variables
| From: | ab@php.net | Date: | Tue, 30 Dec 2014 11:26:11 +0000 |
| Subject: | Bug #68668 [Opn->Nab]: popen does not pass variables | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189514@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68668&edit=1
ID: 68668
Updated by: ab@php.net
Reported by: sandor_hadas at hotmail dot com
Summary: popen does not pass variables
-Status: Open
+Status: Not a bug
Type: Bug
Package: Output Control
Operating System: Windows 7 x64
PHP Version: 5.6.4
Block user comment: N
Private report: N
New Comment:
You seem to have PHP not available on the %path%. Note that your command will expand to
cmd /c "php x.php"
That means the returned $handle will still be valid, as cmd is always available. Same on linux
actually. So you could use PHP_BINARY or better define an exact path to php.exe on your system. And
you should be always checking the error messaged returned from the shell.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2014-12-28 21:22:20] sandor_hadas at hotmail dot com
Description:
------------
The following code executes properly on linux while it fails with both 32bit and 64bit windows. The
problem on windows is that the "abc" string is not received in the x.php file while
outer.php reports that the appropriate number of bytes were successfully written.
Test script:
---------------
outer.php (this is executed)
$handle = popen('php x.php', 'w');
$write = fwrite($handle, "abc\r\n");
fflush($handle);
echo $write;
sleep(10);
pclose($handle);
x.php (this receives "abc" on linux, received nothing on windows)
do {
$c = fgets(STDIN);
print($c);
} while (!feof(STDIN));
sleep(10);
Expected result:
----------------
x.php receives the 5 characters fwrite sent.
Actual result:
--------------
Data not received.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68668&edit=1