|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67085 filesystem functions don't handle anonymous pipes correctly
Submitted: 2014-04-16 14:05 UTC Modified: -
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: yuri dot kanivetsky at gmail dot com Assigned:
Status: Open Package: Filesystem function related
PHP Version: 5.5.11 OS: arch linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: yuri dot kanivetsky at gmail dot com
New email:
PHP Version: OS:


 [2014-04-16 14:05 UTC] yuri dot kanivetsky at gmail dot com
php's filesystem functions can't handle files like /dev/fd/*, e.g.:

$ php -d open_basedir= -r 'var_dump(file_get_contents($_SERVER["argv"][1]));' -- <(echo test)

As opposed to other languages, including C:

$ ruby -e 'p ARGV[0]' <(echo test)
$ perl -e 'open F, @ARGV[0]; print <F>' <(echo test)
$ cat <(echo test)
$ node -e 'var fs = require("fs"); fs.readFile(process.argv[1], "utf8", function(err, data) { console.log(data); })' <(echo test)

Please consider explaining what prevents php from opening such files, if you don't consider it a bug. See the following question on for more details:

Test script:
$ php -d open_basedir= -r 'var_dump(file_get_contents($_SERVER["argv"][1]));' -- <(echo test)

Expected result:

Actual result:
PHP Warning:  fopen(/dev/fd/63): failed to open stream: No such file or directory in Command line code on line 1


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Sep 24 20:03:50 2022 UTC