aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2014-10-27 16:49:30 -0700
committerNils Adermann <naderman@naderman.de>2014-10-27 16:49:30 -0700
commit4e4c3de10316fa5928b309972b49416fba77f5a9 (patch)
treea9c9c368c7ed9b1b9ac855330f774adc1541b03e /phpBB/phpbb
parentaa916fc43f256952eafc81379af9e0b292497044 (diff)
downloadforums-4e4c3de10316fa5928b309972b49416fba77f5a9.tar
forums-4e4c3de10316fa5928b309972b49416fba77f5a9.tar.gz
forums-4e4c3de10316fa5928b309972b49416fba77f5a9.tar.bz2
forums-4e4c3de10316fa5928b309972b49416fba77f5a9.tar.xz
forums-4e4c3de10316fa5928b309972b49416fba77f5a9.zip
[ticket/13227] Properly handle curlwrapper headers in remote avatars
Read a bit of the file to ensure header values are populated and then handle headers in the nested array structure too. PHPBB3-13227
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/avatar/driver/remote.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php
index 1bd7f6c927..4b0ee3f06f 100644
--- a/phpBB/phpbb/avatar/driver/remote.php
+++ b/phpBB/phpbb/avatar/driver/remote.php
@@ -130,8 +130,24 @@ class remote extends \phpbb\avatar\driver\driver
{
// Timeout after 1 second
stream_set_timeout($file_stream, 1);
+ // read some data to ensure headers are present
+ fread($file_stream, 1024);
$meta = stream_get_meta_data($file_stream);
- foreach ($meta['wrapper_data'] as $header)
+
+ if (isset($meta['wrapper_data']['headers']) && is_array($meta['wrapper_data']['headers']))
+ {
+ $headers = $meta['wrapper_data']['headers'];
+ }
+ else if (isset($meta['wrapper_data']) && is_array($meta['wrapper_data']))
+ {
+ $headers = $meta['wrapper_data'];
+ }
+ else
+ {
+ $headers = array();
+ }
+
+ foreach ($headers as $header)
{
$header = preg_split('/ /', $header, 2);
if (strtr(strtolower(trim($header[0], ':')), '_', '-') === 'content-type')