Edit report at https://bugs.php.net/bug.php?id=53465&edit=1

 ID:                 53465
 Comment by:         jakub dot lopuszanski at nasza-klasa dot pl
 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:

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.


Previous Comments:
------------------------------------------------------------------------
[2010-12-11 02:53:27] cataphr...@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] cataphr...@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] cataphr...@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?

------------------------------------------------------------------------
[2010-12-06 23:29:06] cataphr...@php.net

I've attached a patch (against trunk) that allows duping+open arbitrary file 
descriptor. /dev/fd doesn't seem like a good option because it's not portable.

Example:
<?php
$f = fopen("php://fd/1", "w");
fwrite($f, "test");

Can you see if this is enough?

Thanks.

------------------------------------------------------------------------


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

Reply via email to