#35765 [NEW]: fopen wrapper using invalid SIZE command

From: Date: Wed, 21 Dec 2005 17:28:41 +0000
Subject: #35765 [NEW]: fopen wrapper using invalid SIZE command
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90822@lists.php.net to get a copy of this message
From:             jasonandtonya at gmail dot com
Operating system: ALL
PHP version:      5.1.1
PHP Bug Type:     FTP related
Bug description:  fopen wrapper using invalid SIZE command

Description:
------------
when opening a file via ftp as an array 

$logfile=fopen('ftp://example.com/filename.ext',"r");

it returns an error:

500 'SIZE filename.ext': command not understood and example.com is running
a Solaris default ftp daemon.

Looking at the latest version 5.1-latest, (I'm assuming that it is using
ftp_fopen_wrapper.c):

ftp_fopen_wrapper.c,v 1.85.2.2 2005/11/22 03:01:39
line 450:
        /* find out the size of the file (verifying it exists) */
        php_stream_printf(stream TSRMLS_CC, "SIZE %s\r\n",
resource->path);

Is there a reason that you are using a non-standard command SIZE for
verifying existance of the file?

Reproduce code:
---------------
$file=fopen('ftp://example.com/filename.ext',"r");

Expected result:
----------------
No error message when doing fopen

Actual result:
--------------
Warning: fopen('ftp://example.com/filename.ext')
[function.fopen]: failed
to open stream: FTP server reports 500 'SIZE filename.ext': command not
understood. in /patrh/to/htdocs/filename.php on line 3

-- 
Edit bug report at http://bugs.php.net/?id=35765&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35765&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35765&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35765&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35765&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=35765&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35765&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35765&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35765&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35765&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35765&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=35765&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=35765&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35765&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35765&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35765&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35765&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35765&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35765&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35765&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35765&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#90822) next »