php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78653 Documentation for ftp-put contains incorrect default
Submitted: 2019-10-09 07:13 UTC Modified: 2019-10-20 10:43 UTC
From: valeri dot geiser at km-logistik-service dot de Assigned: cmb (profile)
Status: Closed Package: FTP related
PHP Version: 7.3.10 OS: -
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: valeri dot geiser at km-logistik-service dot de
New email:
PHP Version: OS:

 

 [2019-10-09 07:13 UTC] valeri dot geiser at km-logistik-service dot de
Description:
------------
---
From manual page: https://php.net/function.ftp-put
---
The function signature - according to above mentioned documentation page - is:
ftp_put ( resource $ftp_stream , string $remote_file , string $local_file [, int $mode = FTP_IMAGE [, int $startpos = 0 ]] ) : bool

But the parameter doc says
 mode
    The transfer mode. Must be either FTP_ASCII or FTP_BINARY.

So I assume the default for $mode has to be either FTP_ASCII OR FTP_BINARY and not FTP_IMAGE. Since it is FTP_BINARY for ftp_get, I assume it is FTP_BINARY here as well.


Test script:
---------------
N/A


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-09 07:25 UTC] requinix@php.net
-Package: Documentation problem +Package: FTP related
 [2019-10-09 07:25 UTC] requinix@php.net
As mentioned on the Predefined Constants page, FTP_IMAGE is an alias of FTP_BINARY.
 [2019-10-09 07:30 UTC] valeri dot geiser at km-logistik-service dot de
That is correct, however, it is not user-friendly and also inconsistent (at least inside that very page). After all, it confuses that inside one page of documentation, different constants are used.
Following your argumentation, it would also be possible to document it with the default 2, since this is also the same. But does it really help? Shouldn't a documentation be clear and simple? Is it really a good thing that one needs to look at a separate documentation page (predefined constant) to resolve this inconsistency?
 [2019-10-09 07:33 UTC] cmb@php.net
According to the implementation, however, FTP_BINARY is an alias
of FTP_IMAGE[1], not the other way round.

[1] <https://github.com/php/php-src/blob/php-7.3.10/ext/ftp/php_ftp.c#L332>
 [2019-10-13 15:04 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Change FTP_IMAGE to FTP_BINARY
On GitHub:  https://github.com/php/doc-en/pull/15
Patch:      https://github.com/php/doc-en/pull/15.patch
 [2019-10-20 10:43 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2019-10-20 10:43 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.

<http://svn.php.net/viewvc?view=revision&revision=348169>
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Apr 18 05:01:24 2021 UTC