From: smlerman at gmail dot com
Operating system: Any
PHP version: 5.2.8
PHP Bug Type: FTP related
Bug description: FTP fopen wrapper and # in file names
Description:
------------
It seems that the FTP fopen wrapper truncates file names when it
encounters a pound sign (#). The FTP server's log shows a request for
"file".
I have tried replacing the # with %23 (the result of urlencode), but the
server sees that as a request for "file%231.txt".
Reproduce code:
---------------
// Use fopen wrapper
$data = file_get_contents("ftp://username:[email protected]/file
#1.txt");
var_dump(strlen($data));
// Use ftp_* functions
$conn = ftp_connect('ftp.example.com');
ftp_login($conn, 'username', 'password');
ftp_get($conn, 'C:\\test.txt', 'file#1.txt', FTP_BINARY);
var_dump(filesize('C:\\test.txt'));
Expected result:
----------------
int(7)
int(7)
Actual result:
--------------
Warning: file_get_contents(ftp://[email protected]/file#1.txt) [<a
href='function.file-get-contents'>function.file-get-contents</a>]: failed
to open stream: FTP server reports 550 /file : The system cannot find the
path specified. in...
int(0)
int(7)
--
Edit bug report at http://bugs.php.net/?id=47202&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47202&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47202&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47202&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47202&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47202&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47202&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47202&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47202&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47202&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47202&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47202&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47202&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47202&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47202&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47202&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47202&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47202&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47202&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47202&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47202&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47202&r=mysqlcfg