aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-11-21 23:16:22 +0100
committerMarc Alexander <admin@m-a-styles.de>2014-11-21 23:16:22 +0100
commit171837eefe2f8e17597629b108e2aa30c0f4055f (patch)
tree4646873e5041bf5b88e1ebf533d78f358547d1e1 /phpBB/phpbb
parent352648f173e7b132544bf3eaa494184bec6d5aa2 (diff)
downloadforums-171837eefe2f8e17597629b108e2aa30c0f4055f.tar
forums-171837eefe2f8e17597629b108e2aa30c0f4055f.tar.gz
forums-171837eefe2f8e17597629b108e2aa30c0f4055f.tar.bz2
forums-171837eefe2f8e17597629b108e2aa30c0f4055f.tar.xz
forums-171837eefe2f8e17597629b108e2aa30c0f4055f.zip
[ticket/13358] Do not pass variables by reference
PHPBB3-13358
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/file_downloader.php28
-rw-r--r--phpBB/phpbb/version_helper.php8
2 files changed, 15 insertions, 21 deletions
diff --git a/phpBB/phpbb/file_downloader.php b/phpBB/phpbb/file_downloader.php
index 2d5d9a7516..2a2b8dbab5 100644
--- a/phpBB/phpbb/file_downloader.php
+++ b/phpBB/phpbb/file_downloader.php
@@ -38,6 +38,10 @@ class file_downloader
*/
function get($host, $directory, $filename, $port = 80, $timeout = 6)
{
+ // Set default values for error variables
+ $this->error_number = 0;
+ $this->error_string = '';
+
if ($socket = @fsockopen($host, $port, $this->error_number, $this->error_string, $timeout))
{
@fputs($socket, "GET $directory/$filename HTTP/1.0\r\n");
@@ -95,30 +99,22 @@ class file_downloader
}
/**
- * Set error string
- *
- * @param string $error_string Error string
+ * Get error string
*
- * @return self
+ * @return string Error string
*/
- public function set_error_string(&$error_string)
+ public function get_error_string()
{
- $this->error_string = &$error_string;
-
- return $this;
+ return $this->error_string;
}
/**
- * Set error number
+ * Get error number
*
- * @param int $error_number Error number
- *
- * @return self
+ * @return int Error number
*/
- public function set_error_number(&$error_number)
+ public function get_error_number()
{
- $this->error_number = &$error_number;
-
- return $this;
+ return $this->error_number;
}
}
diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php
index d7f1f02678..38050d8ad7 100644
--- a/phpBB/phpbb/version_helper.php
+++ b/phpBB/phpbb/version_helper.php
@@ -254,9 +254,6 @@ class version_helper
}
else if ($info === false || $force_update)
{
- $errstr = $errno = '';
- $this->file_downloader->set_error_number($errno)
- ->set_error_string($errstr);
try {
$info = $this->file_downloader->get($this->host, $this->path, $this->file);
}
@@ -264,10 +261,11 @@ class version_helper
{
throw new \RuntimeException(call_user_func_array(array($this->user, 'lang'), $exception->getMessage()));
}
+ $error_string = $this->file_downloader->get_error_string();
- if (!empty($errstr))
+ if (!empty($error_string))
{
- throw new \RuntimeException($errstr);
+ throw new \RuntimeException($error_string);
}
$info = json_decode($info, true);