Bug #53465 [Com]: Cannot open file descriptor streams

From: Date: Thu, 04 Dec 2014 22:51:23 +0000
Subject: Bug #53465 [Com]: Cannot open file descriptor streams
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188914@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53465&edit=1 ID: 53465 Comment by: dave at lyte dot id dot au Reported by: dchurch at sciencelogic dot com Summary: Cannot open file descriptor streams Status: Duplicate Type: Bug Package: Filesystem function related Operating System: Linux PHP Version: 5.3.3 Assigned To: cataphract Block user comment: N Private report: N New Comment: It's a bit of a crazy work around, but if you're stuck with 5.3.3 for now (because it's the supported version in RHEL6 still) and you really really really want to do this: $pid = getmypid(); $writeFd = popen("cat - > /proc/$pid/fd/3", 'w'); Previous Comments: ------------------------------------------------------------------------ [2013-07-04 06:46:36] jakub dot lopuszanski at nasza-klasa dot pl The problem with "php://fd/3" instead of "/dev/fd/3" is that when I use anonymous fifos in bash like this: php -r 'var_dump($argv);' <(echo "hello") then the output is as follows: array(2) { [0]=> string(1) "-" [1]=> string(10) "/dev/fd/63" } which means that if you have an existing PHP program which accepts filenames, you have to add extra "if" to it, with special case just to handle /dev/fd/63 -> php://fd/3 conversion. I think that this adds extra complexity for the developer in a place where Linux tried hard to eliminate it. ------------------------------------------------------------------------ [2010-12-11 02:53:27] cataphract@php.net Committed to 5.3 and trunk. I'm marking this as a duplicate and request #26158 as closed. Thank you for your report. ------------------------------------------------------------------------ [2010-12-11 02:52:18] cataphract@php.net Automatic comment from SVN on behalf of cataphract Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=306215 Log: - Implemented request #26158/bug #53465 (open arbitrary file descriptor with fopen) ------------------------------------------------------------------------ [2010-12-09 01:31:26] cataphract@php.net 5.3.4 is in the final stages of the release process, so it will not be possible. Maybe 5.3.5, if the release manager agrees with the inclusion. ------------------------------------------------------------------------ [2010-12-08 21:17:58] dchurch at sciencelogic dot com This works like a charm. I much prefer the php://fd/ syntax to fixing the /dev/fd symlink trickery, anyway. The patch also applies cleanly against the 5.3 branch. Will this be in 5.3.4? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=53465 -- Edit this bug report at https://bugs.php.net/bug.php?id=53465&edit=1

« previous php.bugs (#188914) next »