|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 15:00:01 2025 UTC |
Description: ------------ 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 File.read 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 unix.stackexchange.com for more details: http://unix.stackexchange.com/questions/74604/how-to-open-process-substituted-file-from-php Test script: --------------- $ php -d open_basedir= -r 'var_dump(file_get_contents($_SERVER["argv"][1]));' -- <(echo test) Expected result: ---------------- test Actual result: -------------- PHP Warning: fopen(/dev/fd/63): failed to open stream: No such file or directory in Command line code on line 1 bool(false)