composer update

This commit is contained in:
2019-06-23 10:14:30 +00:00
parent a56db5ea2b
commit ec4506ebf4
790 changed files with 35767 additions and 7663 deletions

19
vendor/laravel/framework/SECURITY.md vendored Normal file
View File

@@ -0,0 +1,19 @@
# Security Policy
## Supported Versions
Version | Security Fixes Until
--- | ---
5.8 | February 26th, 2020
5.7 | September 4th, 2019
5.6 | February 7th, 2019
5.5 (LTS) | August 30th, 2020
5.4 | January 24th, 2018
5.3 | August 23rd, 2017
5.2 | December 21st, 2016
5.1 (LTS) | June 9th, 2018
5.0 | February 4th, 2016
## Reporting a Vulnerability
If you discover a security vulnerability within Laravel, please send an email to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.

View File

@@ -229,6 +229,7 @@ class CacheManager implements FactoryContract
$dynamoConfig = [
'region' => $config['region'],
'version' => 'latest',
'endpoint' => $config['endpoint'] ?? null,
];
if ($config['key'] && $config['secret']) {

View File

@@ -390,7 +390,7 @@ class DynamoDbStore implements Store, LockProvider
*/
public function forever($key, $value)
{
return $this->put($key, $value, now()->addYears(5));
return $this->put($key, $value, now()->addYears(5)->getTimestamp());
}
/**

View File

@@ -2,189 +2,9 @@
namespace Illuminate\Database;
use Illuminate\Support\Arr;
use InvalidArgumentException;
use Illuminate\Support\ConfigurationUrlParser as BaseConfigurationUrlParser;
class ConfigurationUrlParser
class ConfigurationUrlParser extends BaseConfigurationUrlParser
{
/**
* The drivers aliases map.
*
* @var array
*/
protected static $driverAliases = [
'mssql' => 'sqlsrv',
'mysql2' => 'mysql', // RDS
'postgres' => 'pgsql',
'postgresql' => 'pgsql',
'sqlite3' => 'sqlite',
];
/**
* Parse the database configuration, hydrating options using a database configuration URL if possible.
*
* @param array|string $config
* @return array
*/
public function parseConfiguration($config)
{
if (is_string($config)) {
$config = ['url' => $config];
}
$url = $config['url'] ?? null;
$config = Arr::except($config, 'url');
if (! $url) {
return $config;
}
$parsedUrl = $this->parseUrl($url);
return array_merge(
$config,
$this->getPrimaryOptions($parsedUrl),
$this->getQueryOptions($parsedUrl)
);
}
/**
* Get the primary database connection options.
*
* @param array $url
* @return array
*/
protected function getPrimaryOptions($url)
{
return array_filter([
'driver' => $this->getDriver($url),
'database' => $this->getDatabase($url),
'host' => $url['host'] ?? null,
'port' => $url['port'] ?? null,
'username' => $url['user'] ?? null,
'password' => $url['pass'] ?? null,
], function ($value) {
return ! is_null($value);
});
}
/**
* Get the database driver from the URL.
*
* @param array $url
* @return string|null
*/
protected function getDriver($url)
{
$alias = $url['scheme'] ?? null;
if (! $alias) {
return;
}
return static::$driverAliases[$alias] ?? $alias;
}
/**
* Get the database name from the URL.
*
* @param array $url
* @return string|null
*/
protected function getDatabase($url)
{
$path = $url['path'] ?? null;
return $path ? substr($path, 1) : null;
}
/**
* Get all of the additional database options from the query string.
*
* @param array $url
* @return array
*/
protected function getQueryOptions($url)
{
$queryString = $url['query'] ?? null;
if (! $queryString) {
return [];
}
$query = [];
parse_str($queryString, $query);
return $this->parseStringsToNativeTypes($query);
}
/**
* Parse the string URL to an array of components.
*
* @param string $url
* @return array
*/
protected function parseUrl($url)
{
$url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
$parsedUrl = parse_url($url);
if ($parsedUrl === false) {
throw new InvalidArgumentException('The database configuration URL is malformed.');
}
return $this->parseStringsToNativeTypes(
array_map('rawurldecode', $parsedUrl)
);
}
/**
* Convert string casted values to their native types.
*
* @param mixed $value
* @return mixed
*/
protected function parseStringsToNativeTypes($value)
{
if (is_array($value)) {
return array_map([$this, 'parseStringsToNativeTypes'], $value);
}
if (! is_string($value)) {
return $value;
}
$parsedValue = json_decode($value, true);
if (json_last_error() === JSON_ERROR_NONE) {
return $parsedValue;
}
return $value;
}
/**
* Get all of the current drivers aliases.
*
* @return array
*/
public static function getDriverAliases()
{
return static::$driverAliases;
}
/**
* Add the given driver alias to the driver aliases array.
*
* @param string $alias
* @param string $driver
* @return void
*/
public static function addDriverAlias($alias, $driver)
{
static::$driverAliases[$alias] = $driver;
}
//
}

View File

@@ -6,6 +6,7 @@ use PDO;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use InvalidArgumentException;
use Illuminate\Support\ConfigurationUrlParser;
use Illuminate\Database\Connectors\ConnectionFactory;
/**

View File

@@ -870,7 +870,11 @@ class Builder
$values
);
$values[$this->qualifyColumn($column)] = $values[$column];
$segments = preg_split('/\s+as\s+/i', $this->query->from);
$qualifiedColumn = end($segments).'.'.$column;
$values[$qualifiedColumn] = $values[$column];
unset($values[$column]);

View File

@@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '5.8.18';
const VERSION = '5.8.19';
/**
* The base path for the Laravel installation.
@@ -519,6 +519,16 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
return $this['env'] === 'local';
}
/**
* Determine if application is in production environment.
*
* @return bool
*/
public function isProduction()
{
return $this['env'] === 'production';
}
/**
* Detect the application's current environment.
*

View File

@@ -48,7 +48,7 @@ class EventListCommand extends Command
$events = [];
foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) {
$providerEvents = array_merge($provider->discoverEvents(), $provider->listens());
$providerEvents = array_merge_recursive($provider->discoverEvents(), $provider->listens());
$events = array_merge_recursive($events, $providerEvents);
}

View File

@@ -703,14 +703,17 @@ if (! function_exists('rescue')) {
*
* @param callable $callback
* @param mixed $rescue
* @param bool $report
* @return mixed
*/
function rescue(callable $callback, $rescue = null)
function rescue(callable $callback, $rescue = null, $report = true)
{
try {
return $callback();
} catch (Throwable $e) {
report($e);
if ($report) {
report($e);
}
return value($rescue);
}

View File

@@ -47,13 +47,30 @@ class TransportManager extends Manager
$transport->setPassword($config['password']);
}
// Next we will set any stream context options specified for the transport
// and then return it. The option is not required any may not be inside
// the configuration array at all so we'll verify that before adding.
return $this->configureSmtpDriver($transport, $config);
}
/**
* Configure the additional SMTP driver options.
*
* @param \Swift_SmtpTransport $transport
* @param array $config
* @return \Swift_SmtpTransport
*/
protected function configureSmtpDriver($transport, $config)
{
if (isset($config['stream'])) {
$transport->setStreamOptions($config['stream']);
}
if (isset($config['source_ip'])) {
$transport->setSourceIp($config['source_ip']);
}
if (isset($config['local_domain'])) {
$transport->setLocalDomain($config['local_domain']);
}
return $transport;
}

View File

@@ -5,6 +5,7 @@ namespace Illuminate\Redis;
use InvalidArgumentException;
use Illuminate\Contracts\Redis\Factory;
use Illuminate\Redis\Connections\Connection;
use Illuminate\Support\ConfigurationUrlParser;
/**
* @mixin \Illuminate\Redis\Connections\Connection
@@ -95,7 +96,10 @@ class RedisManager implements Factory
$options = $this->config['options'] ?? [];
if (isset($this->config[$name])) {
return $this->connector()->connect($this->config[$name], $options);
return $this->connector()->connect(
$this->parseConnectionConfiguration($this->config[$name]),
$options
);
}
if (isset($this->config['clusters'][$name])) {
@@ -113,10 +117,10 @@ class RedisManager implements Factory
*/
protected function resolveCluster($name)
{
$clusterOptions = $this->config['clusters']['options'] ?? [];
return $this->connector()->connectToCluster(
$this->config['clusters'][$name], $clusterOptions, $this->config['options'] ?? []
$this->parseConnectionConfiguration($this->config['clusters'][$name]),
$this->config['clusters']['options'] ?? [],
$this->config['options'] ?? []
);
}
@@ -153,6 +157,21 @@ class RedisManager implements Factory
}
}
/**
* Parse the Redis connection configuration.
*
* @param mixed $config
* @return array
*/
protected function parseConnectionConfiguration($config)
{
$parsed = (new ConfigurationUrlParser)->parseConfiguration($config);
return array_filter($parsed, function ($key) {
return ! in_array($key, ['driver', 'username']);
}, ARRAY_FILTER_USE_KEY);
}
/**
* Return all of the created connections.
*

View File

@@ -35,7 +35,7 @@ class ImplicitRouteBinding
$instance = $container->make($parameter->getClass()->name);
if (! $model = $instance->resolveRouteBinding($parameterValue)) {
throw (new ModelNotFoundException)->setModel(get_class($instance));
throw (new ModelNotFoundException)->setModel(get_class($instance), [$parameterValue]);
}
$route->setParameter($parameterName, $model);

View File

@@ -213,10 +213,14 @@ class Arr
if (! is_array($item)) {
$result[] = $item;
} elseif ($depth === 1) {
$result = array_merge($result, array_values($item));
} else {
$result = array_merge($result, static::flatten($item, $depth - 1));
$values = $depth === 1
? array_values($item)
: static::flatten($item, $depth - 1);
foreach ($values as $value) {
$result[] = $value;
}
}
}

View File

@@ -0,0 +1,189 @@
<?php
namespace Illuminate\Support;
use InvalidArgumentException;
class ConfigurationUrlParser
{
/**
* The drivers aliases map.
*
* @var array
*/
protected static $driverAliases = [
'mssql' => 'sqlsrv',
'mysql2' => 'mysql', // RDS
'postgres' => 'pgsql',
'postgresql' => 'pgsql',
'sqlite3' => 'sqlite',
];
/**
* Parse the database configuration, hydrating options using a database configuration URL if possible.
*
* @param array|string $config
* @return array
*/
public function parseConfiguration($config)
{
if (is_string($config)) {
$config = ['url' => $config];
}
$url = $config['url'] ?? null;
$config = Arr::except($config, 'url');
if (! $url) {
return $config;
}
$parsedUrl = $this->parseUrl($url);
return array_merge(
$config,
$this->getPrimaryOptions($parsedUrl),
$this->getQueryOptions($parsedUrl)
);
}
/**
* Get the primary database connection options.
*
* @param array $url
* @return array
*/
protected function getPrimaryOptions($url)
{
return array_filter([
'driver' => $this->getDriver($url),
'database' => $this->getDatabase($url),
'host' => $url['host'] ?? null,
'port' => $url['port'] ?? null,
'username' => $url['user'] ?? null,
'password' => $url['pass'] ?? null,
], function ($value) {
return ! is_null($value);
});
}
/**
* Get the database driver from the URL.
*
* @param array $url
* @return string|null
*/
protected function getDriver($url)
{
$alias = $url['scheme'] ?? null;
if (! $alias) {
return;
}
return static::$driverAliases[$alias] ?? $alias;
}
/**
* Get the database name from the URL.
*
* @param array $url
* @return string|null
*/
protected function getDatabase($url)
{
$path = $url['path'] ?? null;
return $path ? substr($path, 1) : null;
}
/**
* Get all of the additional database options from the query string.
*
* @param array $url
* @return array
*/
protected function getQueryOptions($url)
{
$queryString = $url['query'] ?? null;
if (! $queryString) {
return [];
}
$query = [];
parse_str($queryString, $query);
return $this->parseStringsToNativeTypes($query);
}
/**
* Parse the string URL to an array of components.
*
* @param string $url
* @return array
*/
protected function parseUrl($url)
{
$url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
$parsedUrl = parse_url($url);
if ($parsedUrl === false) {
throw new InvalidArgumentException('The database configuration URL is malformed.');
}
return $this->parseStringsToNativeTypes(
array_map('rawurldecode', $parsedUrl)
);
}
/**
* Convert string casted values to their native types.
*
* @param mixed $value
* @return mixed
*/
protected function parseStringsToNativeTypes($value)
{
if (is_array($value)) {
return array_map([$this, 'parseStringsToNativeTypes'], $value);
}
if (! is_string($value)) {
return $value;
}
$parsedValue = json_decode($value, true);
if (json_last_error() === JSON_ERROR_NONE) {
return $parsedValue;
}
return $value;
}
/**
* Get all of the current drivers aliases.
*
* @return array
*/
public static function getDriverAliases()
{
return static::$driverAliases;
}
/**
* Add the given driver alias to the driver aliases array.
*
* @param string $alias
* @param string $driver
* @return void
*/
public static function addDriverAlias($alias, $driver)
{
static::$driverAliases[$alias] = $driver;
}
}

View File

@@ -6,12 +6,14 @@ use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract;
/**
* @method static \Illuminate\Http\Response make(string $content = '', int $status = 200, array $headers = [])
* @method static \Illuminate\Http\Response noContent($status = 204, array $headers = [])
* @method static \Illuminate\Http\Response view(string $view, array $data = [], int $status = 200, array $headers = [])
* @method static \Illuminate\Http\JsonResponse json(string|array $data = [], int $status = 200, array $headers = [], int $options = 0)
* @method static \Illuminate\Http\JsonResponse jsonp(string $callback, string|array $data = [], int $status = 200, array $headers = [], int $options = 0)
* @method static \Symfony\Component\HttpFoundation\StreamedResponse stream(\Closure $callback, int $status = 200, array $headers = [])
* @method static \Symfony\Component\HttpFoundation\StreamedResponse streamDownload(\Closure $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
* @method static \Symfony\Component\HttpFoundation\BinaryFileResponse download(\SplFileInfo|string $file, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
* @method static \Symfony\Component\HttpFoundation\BinaryFileResponse file($file, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse redirectTo(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
* @method static \Illuminate\Http\RedirectResponse redirectToRoute(string $route, array $parameters = [], int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse redirectToAction(string $action, array $parameters = [], int $status = 302, array $headers = [])

View File

@@ -12,9 +12,9 @@ namespace Illuminate\Support\Facades;
* @method static string route(string $name, $parameters = [], bool $absolute = true)
* @method static string action(string $action, $parameters = [], bool $absolute = true)
* @method static \Illuminate\Contracts\Routing\UrlGenerator setRootControllerNamespace(string $rootNamespace)
* @method static string signedRoute(string $name, array $parameters = [], \DateTimeInterface|\DateInterval|int $expiration = null)
* @method static string temporarySignedRoute(string $name, \DateTimeInterface|\DateInterval|int $expiration, array $parameters = [])
* @method static string hasValidSignature(\Illuminate\Http\Request $request, bool $absolute)
* @method static string signedRoute(string $name, array $parameters = [], \DateTimeInterface|\DateInterval|int $expiration = null, bool $absolute = true)
* @method static string temporarySignedRoute(string $name, \DateTimeInterface|\DateInterval|int $expiration, array $parameters = [], bool $absolute = true)
* @method static string hasValidSignature(\Illuminate\Http\Request $request, bool $absolute = true)
* @method static void defaults(array $defaults)
*
* @see \Illuminate\Routing\UrlGenerator