| @@ -93,9 +93,9 @@ | ||
| 93 | 93 | * @param S3ClientInterface $client Client to use with the stream wrapper |
| 94 | 94 | * @param string $protocol Protocol to register as. |
| 95 | 95 | * @param CacheInterface $cache Default cache for the protocol. |
| 96 | 96 | */ |
| 97 | - public static function register(S3ClientInterface $client, $protocol = 's3', CacheInterface $cache = null, $v2Existence = \false) | |
| 97 | + public static function register(S3ClientInterface $client, $protocol = 's3', ?CacheInterface $cache = null, $v2Existence = \false) | |
| 98 | 98 | { |
| 99 | 99 | self::$useV2Existence = $v2Existence; |
| 100 | 100 | if (\in_array($protocol, \stream_get_wrappers())) { |
| 101 | 101 | \stream_wrapper_unregister($protocol); |
| @@ -214,9 +214,9 @@ | ||
| 214 | 214 | public function url_stat($path, $flags) |
| 215 | 215 | { |
| 216 | 216 | $this->initProtocol($path); |
| 217 | 217 | // Some paths come through as S3:// for some reason. |
| 218 | - $split = \explode('://', $path); | |
| 218 | + $split = \explode('://', $path, 2); | |
| 219 | 219 | $path = \strtolower($split[0]) . '://' . $split[1]; |
| 220 | 220 | // Check if this path is in the url_stat cache |
| 221 | 221 | if ($value = $this->getCacheStorage()->get($path)) { |
| 222 | 222 | return $value; |
| @@ -468,8 +468,25 @@ | ||
| 468 | 468 | public function stream_cast($cast_as) |
| 469 | 469 | { |
| 470 | 470 | return \false; |
| 471 | 471 | } |
| 472 | + public function stream_set_option($option, $arg1, $arg2) | |
| 473 | + { | |
| 474 | + return \false; | |
| 475 | + } | |
| 476 | + public function stream_metadata($path, $option, $value) | |
| 477 | + { | |
| 478 | + return \false; | |
| 479 | + } | |
| 480 | + public function stream_lock($operation) | |
| 481 | + { | |
| 482 | + \trigger_error('stream_lock() is not supported by the Amazon S3 stream wrapper', \E_USER_WARNING); | |
| 483 | + return \false; | |
| 484 | + } | |
| 485 | + public function stream_truncate($new_size) | |
| 486 | + { | |
| 487 | + return \false; | |
| 488 | + } | |
| 472 | 489 | /** |
| 473 | 490 | * Validates the provided stream arguments for fopen and returns an array |
| 474 | 491 | * of errors. |
| 475 | 492 | */ |
| @@ -542,9 +559,9 @@ | ||
| 542 | 559 | } |
| 543 | 560 | private function getBucketKey($path) |
| 544 | 561 | { |
| 545 | 562 | // Remove the protocol |
| 546 | - $parts = \explode('://', $path); | |
| 563 | + $parts = \explode('://', $path, 2); | |
| 547 | 564 | // Get the bucket, key |
| 548 | 565 | $parts = \explode('/', $parts[1], 2); |
| 549 | 566 | return ['Bucket' => $parts[0], 'Key' => isset($parts[1]) ? $parts[1] : null]; |
| 550 | 567 | } |
| @@ -657,8 +674,9 @@ | ||
| 657 | 674 | $method = self::$useV2Existence ? 'doesBucketExistV2' : 'doesBucketExist'; |
| 658 | 675 | if ($this->getClient()->{$method}($params['Bucket'])) { |
| 659 | 676 | return $this->triggerError("Bucket already exists: {$path}"); |
| 660 | 677 | } |
| 678 | + unset($params['ACL']); | |
| 661 | 679 | return $this->boolCall(function () use($params, $path) { |
| 662 | 680 | $this->getClient()->createBucket($params); |
| 663 | 681 | $this->clearCacheKey($path); |
| 664 | 682 | return \true; |