|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-10-21 09:16 UTC] julien dot chavee at gmail dot com
Description:
------------
The PHP function ftp_login() return false with the following warning when the password contains the character colon (:):
"PHP Warning: ftp_login(): 500"
Test script:
---------------
<?php
$connection = ftp_connect(
'[SERVER]',
'[PORT]',
'[TIMEOUT]'
);
if($connection !== false) {
$login = ftp_login(
$connection,
'[USERNAME]',
'abc:def'
);
if($login === true) {
echo 'Success';
} else {
echo 'Failed';
}
Expected result:
----------------
Display 'Success'
Actual result:
--------------
Display 'Failed' with the warning "PHP Warning: ftp_login(): 500"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 23:00:01 2025 UTC |
Would it work, if you passed the following as $password: urlencode('abc:def')After having a closer look, I fail to see why that would fail (unless the username/password combination is invalid). ftp_login() just sends the following commands USER [USERNAME] PASS abc:def What would happen if you send these commands via ftp_raw() or via telnet? Also, can you please inspect the network traffic to see whether the colon gets mangled somehow? And which FTP server do you use?