Bug->Doc #76471 [Opn]: PHP Warning: ftp_get() expects at least 4 parameters, 3 given
| From: | nikic@php.net | Date: | Wed, 13 Jun 2018 15:07:18 +0000 |
| Subject: | Bug->Doc #76471 [Opn]: PHP Warning: ftp_get() expects at least 4 parameters, 3 given | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15763@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76471&edit=1
ID: 76471
Updated by: nikic@php.net
Reported by: peter279k at gmail dot com
Summary: PHP Warning: ftp_get() expects at least 4
parameters, 3 given
Status: Open
-Type: Bug
+Type: Documentation Problem
Package: FTP related
Operating System: Ubuntu 16.04
PHP Version: 7.0.30
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2018-06-13 15:04:25] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76471&edit=1