Bug #73457 [Opn->Csd]: Wrong error message when fopen FTP wrapped fails to open data connection
Edit report at https://bugs.php.net/bug.php?id=73457&edit=1
ID: 73457
Updated by: nikic@php.net
Reported by: martin at winscp dot net
Summary: Wrong error message when fopen FTP wrapped fails to
open data connection
-Status: Open
+Status: Closed
Type: Bug
Package: Streams related
Operating System: Any
PHP Version: 7.0.12
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of vhu@iki.fi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=742783c3ee4df424b5bd9130028951259ca52860
Log: Fixed bug #73457
Previous Comments:
------------------------------------------------------------------------
[2018-08-24 21:12:38] vhu at iki dot fi
Pull request has been added to fix this: https://github.com/php/php-src/pull/3466
------------------------------------------------------------------------
[2016-11-04 08:11:22] martin at winscp dot net
Description:
------------
In the php_stream_url_wrap_ftp function in ext/standard/ftp_fopen_wrapper.c, the tmp_line local
variable is used for two distinct purposes:
1) parsing SIZE response
php_stream_notify_file_size(context, file_size, tmp_line, result);
2) constructing RETR/STOR/APPE request
memcpy(tmp_line, "RETR", sizeof("RETR"));
...
When the function fails (jumps to errexit) the tmp_line variable is used to construct an error
message:
php_stream_wrapper_log_error(wrapper, options, "FTP server reports %s", tmp_line);
So when the function fails only after the tmp_line is reused for purpose 2), like when a data
connection cannot be opened, the error message is nonsense like:
> failed to open stream: FTP server reports STOR
I'm reporting this based on this http://stackoverflow.com/q/40415540/850848
The error is present at least since PHP 5.5, up to the PHP 7.0.12.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73457&edit=1
Thread (2 messages)