php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79100 PHP Warning: and ftp_get() returns false
Submitted: 2020-01-11 12:50 UTC Modified: 2021-02-19 18:27 UTC
From: brainforge dot uk at btinternet dot com Assigned: cmb (profile)
Status: Closed Package: FTP related
PHP Version: 7.3.13 OS: Centos 7
Private report: No CVE-ID: None
 [2020-01-11 12:50 UTC] brainforge dot uk at btinternet dot com
Description:
------------
In PHP 7.3 get the following warning:

PHP Warning:  ftp_get(): Opening data channel for file download from server of "???" in ???.php on line ???

Works fine in PHP 7.2.
Program fails with error and warning message in PHP 7.3

File size 4.5MB

Test script:
---------------
if (ftp_get())
{
  echo 'Everything OK';
}
else
{
  die('Help!!!');
}



Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-11 16:13 UTC] brainforge dot uk at btinternet dot com
Problem appears to be related to timeout.
The default is 90 seconds.
ftp_set_option($conn_id, FTP_TIMEOUT_SEC, $timeout)

Something confusing here - the message should indicate timeout occurred.
Also in the particular instance the resulting file is sometimes complete!

ftp_get() needs something more than just TRUE or FALSE result - or another function to check the result operation detail such as ftp_status().
 [2021-02-19 18:27 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-02-19 18:27 UTC] cmb@php.net
FTP errors are reported via the usual PHP error reporting
mechanism, so the warnings are available via error_get_last().
However, in case of timeout, you always get the last message from
the FTP server, what is of course wrong.
 [2021-02-23 11:38 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #79100: Wrong FTP error messages
On GitHub:  https://github.com/php/php-src/pull/6718
Patch:      https://github.com/php/php-src/pull/6718.patch
 [2021-05-03 13:26 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/php-src/commit/42c72ef463603722e81a6b86443bdb753318b700
Log: Fix #79100: Wrong FTP error messages
 [2021-05-03 13:26 UTC] git@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon May 17 05:01:24 2021 UTC