#26532 [Bgs]: passthru does not work with subshells
| From: | arne at fotos dot dyndns dot biz | Date: | Fri, 05 Dec 2003 14:25:56 +0000 |
| Subject: | #26532 [Bgs]: passthru does not work with subshells | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51727@lists.php.net to get a copy of this message | ||
ID: 26532
User updated by: arne at fotos dot dyndns dot biz
Reported By: arne at fotos dot dyndns dot biz
Status: Bogus
Bug Type: Program Execution
Operating System: LINUX
PHP Version: 4.3.4
New Comment:
well, I can, because this works: passthru("cat t | diff - t2"); that
means just a pipe stack (or anything else) seems to be corrupt
BRgds,
Arne
Previous Comments:
------------------------------------------------------------------------
[2003-12-05 09:17:39] iliaa@php.net
You cannot pipe data into programs executed by PHP.
Just do passthru("diff t t2");
------------------------------------------------------------------------
[2003-12-05 08:30:57] arne at fotos dot dyndns dot biz
Description:
------------
when I have 2 files t and t2 and I try to diff them with
diff <(cat t) <(cat t2) LINUX-shell produces 2 meta-files
(/dev/fd/[00-99]) to pipe into the diff command. Thats usual, thats
basic.
If I try to use the same command in passthru("diff <(cat t) <(cat
t2)"); I run into errors:
sh: -c: line 1: syntax error near unexpected token '('
sh: -c: line 1: 'diff <(cat t) <(cat t2)'
The files are in the PATH and I can see output of t when I do:
passthru("cat t"); what means that cat is available too.
Reproduce code:
---------------
file X.php4:
-----snip--------
<?php passthru("diff <(cat t) <(cat t2)"); ?>
-------snap------
shell:> php X.php4
Expected result:
----------------
1,3c1,4
< MIKE
< bravo
< charly
---
> VANDA
> PHP
> Utah
> russia
Actual result:
--------------
sh: -c: line 1: syntax error near unexpected token '('
sh: -c: line 1: 'diff <(cat t) <(cat t2)'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26532&edit=1