diff options
author | Robin Appelman <robin@icewind.nl> | 2017-01-19 14:38:03 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2017-01-26 12:19:32 +0100 |
commit | c9ecd64d360e6e14e06ce5ba7cc571cca396ecca (patch) | |
tree | f5fef2c643069321982fa8925265b2f920f0df77 /apps/files_external/3rdparty/icewind | |
parent | 3a603ab8b421b306373e06b9d1210e6013093a99 (diff) | |
download | nextcloud-server-c9ecd64d360e6e14e06ce5ba7cc571cca396ecca.tar.gz nextcloud-server-c9ecd64d360e6e14e06ce5ba7cc571cca396ecca.zip |
update icewind/streams to 0.5.2
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/3rdparty/icewind')
4 files changed, 36 insertions, 5 deletions
diff --git a/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php index c5847b95fdb..4eef55681c7 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php @@ -107,6 +107,8 @@ class CallbackWrapper extends Wrapper { $result = parent::stream_close(); if (is_callable($this->closeCallback)) { call_user_func($this->closeCallback); + // prevent further calls by potential PHP 7 GC ghosts + $this->closeCallback = null; } return $result; } diff --git a/apps/files_external/3rdparty/icewind/streams/src/Path.php b/apps/files_external/3rdparty/icewind/streams/src/Path.php index 46d2156b69a..bef9fd5f616 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/Path.php +++ b/apps/files_external/3rdparty/icewind/streams/src/Path.php @@ -56,7 +56,7 @@ class Path { protected function register() { if (!$this->registered) { - $this->appendDefaultContent($this->getProtocol(), $this->contextOptions); + $this->appendDefaultContent($this->contextOptions); stream_wrapper_register($this->getProtocol(), $this->class); $this->registered = true; } @@ -71,13 +71,17 @@ class Path { /** * Add values to the default stream context * - * @param string $key * @param array $values */ - protected function appendDefaultContent($key, $values) { + protected function appendDefaultContent($values) { + if (!is_array(current($values))) { + $values = array($this->getProtocol() => $values); + } $context = stream_context_get_default(); $defaults = stream_context_get_options($context); - $defaults[$key] = $values; + foreach ($values as $key => $value) { + $defaults[$key] = $value; + } stream_context_set_default($defaults); } diff --git a/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php new file mode 100644 index 00000000000..88af7e17b33 --- /dev/null +++ b/apps/files_external/3rdparty/icewind/streams/src/PathWrapper.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright (c) 2016 Robin Appelman <icewind@owncloud.com> + * This file is licensed under the Licensed under the MIT license: + * http://opensource.org/licenses/MIT + */ + +namespace Icewind\Streams; + +/** + * A string-like object that maps to an existing stream when opened + */ +class PathWrapper extends NullWrapper { + /** + * @param resource $source + * @return Path|string + */ + public static function getPath($source) { + return new Path(__CLASS__, [ + 'null' => [ + 'source' => $source + ] + ]); + } +} diff --git a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php b/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php index 53de2942ca9..8e52eff9a08 100644 --- a/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php +++ b/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php @@ -53,7 +53,7 @@ abstract class Wrapper implements File, Directory { if (isset($context[$name])) { $context = $context[$name]; } else { - throw new \BadMethodCallException('Invalid context, "callable" options not set'); + throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set'); } if (isset($context['source']) and is_resource($context['source'])) { $this->setSourceStream($context['source']); |