Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #79100: Wrong FTP error messages
First we need to properly clear the `inbuf`, what is an amendment to commit d2881ad[1]. Then we need to report `php_pollfd_for_ms()` failures right away; just setting `errno` does not really help, since at least in some cases it would have been overwritten before we actually could check it. We use `php_socket_strerror()` to get a proper error message, and define `ETIMEDOUT` to the proper value on Windows; otherwise we catch the definition in errno.h, which is not compatible with WinSock. The proper solution for this issue would likely be to include something like ext/sockets/windows_common.h. Finally, we ensure that we only report warnings using `inbuf`, if it is not empty. [1] <http://git.php.net/?p=php-src.git;a=commit;h=d2881adcbc9be60de7e7d45a3316b0e11b7eb1e8>. Closes GH-6718.
- Loading branch information
Showing
5 changed files
with
112 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
Bug #79100 (Wrong FTP error messages) | ||
--SKIPIF-- | ||
<?php | ||
require 'skipif.inc'; | ||
?> | ||
--FILE-- | ||
<?php | ||
$bug79100 = true; | ||
require 'server.inc'; | ||
|
||
$ftp = ftp_connect("127.0.0.1", $port); | ||
if (!$ftp) die("Couldn't connect to the server"); | ||
var_dump(ftp_login($ftp, 'user', 'pass')); | ||
var_dump(ftp_set_option($ftp, FTP_TIMEOUT_SEC, 1)); | ||
ftp_systype($ftp); | ||
?> | ||
--EXPECTF-- | ||
bool(true) | ||
bool(true) | ||
|
||
Warning: ftp_systype(): %rConnection|Operation%r timed out in %s on line %d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters