#26532 [Opn->Bgs]: passthru does not work with subshells

From: Date: Fri, 05 Dec 2003 14:17:39 +0000
Subject: #26532 [Opn->Bgs]: passthru does not work with subshells
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-51726@lists.php.net to get a copy of this message
ID: 26532 Updated by: iliaa@php.net Reported By: arne at fotos dot dyndns dot biz -Status: Open +Status: Bogus Bug Type: Program Execution Operating System: LINUX PHP Version: 4.3.4 New Comment: You cannot pipe data into programs executed by PHP. Just do passthru("diff t t2"); Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#51726) next »