php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76471 PHP Warning: ftp_get() expects at least 4 parameters, 3 given
Submitted: 2018-06-13 15:04 UTC Modified: 2018-06-13 16:03 UTC
From: peter279k at gmail dot com Assigned: cmb (profile)
Status: Closed Package: FTP related
PHP Version: 7.0.30 OS: Ubuntu 16.04
Private report: No CVE-ID: None
 [2018-06-13 15:04 UTC] peter279k at gmail dot com
Description:
------------
As title, when I try to use the ftp_get function to develop my project. I also got the error message.

When I refer the PHP official doc, it seems that the ftp_get can accept the three parameters expect, not 4. Is the official doc wrong?

PHP official doc: http://php.net/manual/en/function.ftp-get.php

Test script:
---------------
<?php

// define some variables
$local_file = 'local.zip';
$server_file = 'server.zip';

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file)) {
    echo "Successfully written to $local_file\n";
} else {
    echo "There was a problem\n";
}

// close the connection
ftp_close($conn_id);


Expected result:
----------------
No error

Actual result:
--------------
PHP Warning: ftp_get() expects at least 4 parameters, 3 given

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-06-13 15:07 UTC] nikic@php.net
-Type: Bug +Type: Documentation Problem
 [2018-06-13 15:07 UTC] nikic@php.net
The parameter is optional as of PHP 7.3. The docs need a changelog and maybe additional clarification that the parameter is required in previous versions.
 [2018-06-13 15:52 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2018-06-13 16:03 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=345129
Log: Fix #76471: PHP Warning: ftp_get() expects at least 4 parameters, 3 given

We add the missing changelog entries.
 [2018-06-13 16:03 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2018-06-13 16:03 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:05 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=f8cde5e160ab14cdb756f64ee805d63c6f90cc69
Log: Fix #76471: PHP Warning: ftp_get() expects at least 4 parameters, 3 given
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 20:01:45 2024 UTC