Doc #78653 [PATCH]: Documentation for ftp-put contains incorrect default
| From: | cmb@php.net | Date: | Sun, 13 Oct 2019 15:04:25 +0000 |
| Subject: | Doc #78653 [PATCH]: Documentation for ftp-put contains incorrect default | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-17003@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78653&edit=1
ID: 78653
Patch added by: cmb@php.net
Reported by: valeri dot geiser at km-logistik-service dot de
Summary: Documentation for ftp-put contains incorrect default
Status: Open
Type: Documentation Problem
Package: FTP related
Operating System: -
PHP Version: 7.3.10
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2019-10-09 07:33:11] 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-09 07:30:34] 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:25:36] requinix@php.net
As mentioned on the Predefined Constants page, FTP_IMAGE is an alias of FTP_BINARY.
------------------------------------------------------------------------
[2019-10-09 07:13:42] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78653&edit=1