From 29a23ae217efed86e6b5afff4c9a0b1271eb20f4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 25 Aug 2011 20:34:01 +0200 Subject: [PATCH] [ticket/10278] Return with a timeout error when fread() or fgets() time out. PHPBB3-10278 --- phpBB/includes/functions_admin.php | 8 ++++++++ phpBB/language/en/common.php | 1 + 2 files changed, 9 insertions(+) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index ee146ca214..8b9b80b23d 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3164,6 +3164,14 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port return false; } } + + $stream_meta_data = stream_get_meta_data($fsock); + + if (!empty($stream_meta_data['timed_out'])) + { + $errstr = $user->lang['FSOCK_TIMEOUT']; + return false; + } } @fclose($fsock); } diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 1c96818346..2eca49d3e0 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -200,6 +200,7 @@ $lang = array_merge($lang, array( 'FORUM_RULES_LINK' => 'Please click here to view the forum rules', 'FROM' => 'from', 'FSOCK_DISABLED' => 'The operation could not be completed because the fsockopen function has been disabled or the server being queried could not be found.', + 'FSOCK_TIMEOUT' => 'A timeout occurred while reading from the network stream.', 'FTP_FSOCK_HOST' => 'FTP host', 'FTP_FSOCK_HOST_EXPLAIN' => 'FTP server used to connect your site.',