php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49507 ftp_login() returns null
Submitted: 2009-09-09 07:42 UTC Modified: 2009-09-10 07:31 UTC
From: dro at mediaan dot nl Assigned:
Status: Not a bug Package: FTP related
PHP Version: 5.2.10 OS: FreeBSD 5.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dro at mediaan dot nl
New email:
PHP Version: OS:

 

 [2009-09-09 07:42 UTC] dro at mediaan dot nl
Description:
------------
After upgrading our PHP version from 4.4.9 to 5.2.10 we are experiencing problems with FTP.

The example below used to return true for variable $login_result under PHP version 4.4.9. After migration to PHP version 5.2.10 the example below returns null for variable $login_result.

Reproduce code:
---------------
$conn_id = @ftp_ssl_connect($ftp_server);
$login_result = @ftp_login($conn_id, $ftp_username, $ftp_password);


Expected result:
----------------
true

Actual result:
--------------
null

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-09 08:45 UTC] jani@php.net
And what might it output if you removed the @'s ? There's quite likely and error that happens which you now don't know anything about..
 [2009-09-09 09:04 UTC] dro at mediaan dot nl
After removing the @'s I get a warning.

Warning: ftp_login() [function.ftp-login]: 'AUTH SSL': command not understood in /usr/jail/home/a/aevitae/htdocs/incl_stap7.php on line 229.
 [2009-09-09 10:04 UTC] jani@php.net
"Well, there's your problem." -- Q:-{)

Check the target ftp server if it actually supports such. Doesn't seem to be any bug per se. 
 [2009-09-09 10:35 UTC] dro at mediaan dot nl
When I change the line "$conn_id = @ftp_ssl_connect($ftp_server);" to "$conn_id = @ftp_connect($ftp_server);" it works.

I'm a little confused. 

Does this mean the FTP server I'm trying to connect to doesn't support ftp_ssl_connect?

Why am I getting the error message on ftp_login rather then ftp_ssl_connect then?

How is this possible when nothing has changed on the FTP server configuration? The same code used to work under PHP 4.4.9 while connecting to the same FTP server.
 [2009-09-09 19:36 UTC] jani@php.net
RTFM: http://www.php.net/ftp_ssl_connect

And search for the "Changelog" and there's your answer..

 [2009-09-10 07:31 UTC] dro at mediaan dot nl
Changelog
5.2.2: The function was changed to return FALSE when it can't use an SSL connection, instead of fallbacking to a non-SSL one as previously. 

Above is what the changelog says. But ftp_ssl_connect doesn't return FALSE. It does return a SSL-FTP stream. 

It is the function call to ftp_login that returns NULL. Looking at the manual ftp_login can either return TRUE or FALSE, but not NULL.

Please read my earlier comments!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC