From: bmorel at ssi dot fr
Operating system: CentOS 5
PHP version: 5.2.10
PHP Bug Type: FTP related
Bug description: fopen() ftp wrapper and SIZE command
Description:
------------
(Request for reopening bug #35765)
Sorry to restart this thread more than 3 years later, but I'm facing the
very same problem and cannot add a comment on a "won't fix" bug.
The problem concerns the fopen()'s ftp wrapper incorrectly relying on the
ftp SIZE command to check whether a file is downloadable.
I do think that's not a correct behaviour.
For example I'm using a ftp server from a well-known affiliate marketing
company, that's serving "virtual" files, that are not displayed in the ftp
server as such, but downloadable by any ftp client I could try... except
php's fopen wrapper.
The problem is that this server returns a "550 Not a plain file" error for
a SIZE request. This is not a plain file, but it is perfectly
downloadable.
The SIZE command is *not* standardized in RFC 959. It may be used by ftp
clients, but only to try to get some information about the file.
Refusing to download a file due to a SIZE command failing is not RFC
compliant, while the servers the previous bug reporter and I are using,
are.
Reproduce code:
---------------
$fp = fopen("ftp://example.com/test.xml.gz", "rb");
var_dump($fp);
Expected result:
----------------
bool(true)
Actual result:
--------------
Warning: fopen(ftp://example.com/test.xml.gz) [function.fopen]: failed to
open stream: FTP server reports 550 /test.xml.gz: not a plain file.
bool(false)
--
Edit bug report at http://bugs.php.net/?id=48674&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48674&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48674&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48674&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48674&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48674&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48674&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48674&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48674&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48674&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48674&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48674&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48674&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48674&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48674&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48674&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48674&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48674&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48674&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48674&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48674&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48674&r=mysqlcfg