Skip to content

Commit

Permalink
Merge branch 'master' into merge
Browse files Browse the repository at this point in the history
  • Loading branch information
chu121su12 committed May 10, 2021
2 parents c30883e + bc54ad9 commit 91bf4f1
Show file tree
Hide file tree
Showing 34 changed files with 197 additions and 97 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ about: "Report something that's broken. Please ensure your Laravel version is st


### Steps To Reproduce:

<!-- If possible, please provide a GitHub repository to demonstrate your issue -->
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
ports:
- 6379:6379
options: --entrypoint redis-server

strategy:
fail-fast: true
matrix:
Expand All @@ -38,7 +39,6 @@ jobs:
flags: "--ignore-platform-req=php"
stability: prefer-stable


name: PHP ${{ matrix.php }} - ${{ matrix.stability }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
"phpunit/phpunit": "Required to use assertions and run tests (^9.4).",
"predis/predis": "Required to use the predis connector (^1.1.2).",
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0|^6.0).",
"symfony/cache": "Required to PSR-6 cache bridge (^5.3).",
"symfony/filesystem": "Required to enable support for relative symbolic links (^5.3).",
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function validAuthenticationResponse($request, $result)
$request->channel_name,
$request->socket_id,
$userData = array_filter([
'user_id' => $this->retrieveUser($request, $channelName)->getAuthIdentifier(),
'user_id' => (string) $this->retrieveUser($request, $channelName)->getAuthIdentifier(),
'user_info' => $result,
])
);
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Broadcasting/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
},
"suggest": {
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0)."
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0|^6.0)."
},
"config": {
"sort-packages": true
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Factories/Sequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(...$sequence)
*/
public function __invoke()
{
if ($this->index > ($this->count - 1)) {
if ($this->index >= $this->count) {
$this->index = 0;
}

Expand Down
8 changes: 3 additions & 5 deletions src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function compileDropDatabaseIfExists($name)
*/
public function compileTableExists()
{
return "select * from sysobjects where type = 'U' and name = ?";
return "select * from sys.sysobjects where id = object_id(?, 'U')";
}

/**
Expand All @@ -75,9 +75,7 @@ public function compileTableExists()
*/
public function compileColumnListing($table)
{
return "select col.name from sys.columns as col
join sys.objects as obj on col.object_id = obj.object_id
where obj.type = 'U' and obj.object_id = object_id('$table')";
return "select name from sys.columns where object_id = object_id('$table', 'U')";
}

/**
Expand Down Expand Up @@ -194,7 +192,7 @@ public function compileDrop(Blueprint $blueprint, Fluent $command)
*/
public function compileDropIfExists(Blueprint $blueprint, Fluent $command)
{
return sprintf('if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = %s) drop table %s',
return sprintf('if exists (select * from sys.sysobjects where id = object_id(%s, \'U\')) drop table %s',
"'".str_replace("'", "''", $this->getTablePrefix().$blueprint->getTable())."'",
$this->wrapTable($blueprint)
);
Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Schema/PostgresSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function dump(Connection $connection, $path)
})->implode(' ');

$this->makeProcess(
$this->baseDumpCommand().' --file=$LARAVEL_LOAD_PATH '.$excludedTables
$this->baseDumpCommand().' --file="${:LARAVEL_LOAD_PATH}" '.$excludedTables
)->mustRun($this->output, array_merge($this->baseVariables($this->connection->getConfig()), [
'LARAVEL_LOAD_PATH' => $path,
]));
Expand All @@ -39,10 +39,10 @@ public function dump(Connection $connection, $path)
*/
public function load($path)
{
$command = 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_restore --no-owner --no-acl --clean --if-exists --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE $LARAVEL_LOAD_PATH';
$command = 'pg_restore --no-owner --no-acl --clean --if-exists --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}" "${:LARAVEL_LOAD_PATH}"';

if (Str::endsWith($path, '.sql')) {
$command = 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD psql --file=$LARAVEL_LOAD_PATH --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE';
$command = 'psql --file="${:LARAVEL_LOAD_PATH}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}"';
}

$process = $this->makeProcess($command);
Expand All @@ -59,7 +59,7 @@ public function load($path)
*/
protected function baseDumpCommand()
{
return 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_dump --no-owner --no-acl -Fc --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER $LARAVEL_LOAD_DATABASE';
return 'pg_dump --no-owner --no-acl -Fc --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --username="${:LARAVEL_LOAD_USER}" --dbname="${:LARAVEL_LOAD_DATABASE}"';
}

/**
Expand All @@ -76,7 +76,7 @@ protected function baseVariables(array $config)
'LARAVEL_LOAD_HOST' => is_array($config['host']) ? $config['host'][0] : $config['host'],
'LARAVEL_LOAD_PORT' => $config['port'],
'LARAVEL_LOAD_USER' => $config['username'],
'LARAVEL_LOAD_PASSWORD' => $config['password'],
'PGPASSWORD' => $config['password'],
'LARAVEL_LOAD_DATABASE' => $config['database'],
];
}
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,28 @@ class Handler implements ExceptionHandlerContract
/**
* A list of the exception types that are not reported.
*
* @var array
* @var string[]
*/
protected $dontReport = [];

/**
* The callbacks that should be used during reporting.
*
* @var array
* @var \Illuminate\Foundation\Exceptions\ReportableHandler[]
*/
protected $reportCallbacks = [];

/**
* The callbacks that should be used during rendering.
*
* @var array
* @var \Closure[]
*/
protected $renderCallbacks = [];

/**
* The registered exception mappings.
*
* @var array
* @var array<string, \Closure>
*/
protected $exceptionMap = [];

Expand Down
10 changes: 10 additions & 0 deletions src/Illuminate/Foundation/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,16 @@ protected function syncMiddlewareToRouter()
}
}

/**
* Get the priority-sorted list of middleware.
*
* @return array
*/
public function getMiddlewarePriority()
{
return $this->middlewarePriority;
}

/**
* Get the bootstrap classes for the application.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/Jobs/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected function failed($e)
list($class, $method) = JobName::parse($payload['job']);

if (method_exists($this->instance = $this->resolve($class), 'failed')) {
$this->instance->failed($payload['data'], $e, $payload['uuid']);
$this->instance->failed($payload['data'], $e, $payload['uuid'] ?? '');
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,13 @@ protected function runRouteWithinStack(Route $route, Request $request)
*/
public function gatherRouteMiddleware(Route $route)
{
$computedMiddleware = $route->gatherMiddleware();

$excluded = collect($route->excludedMiddleware())->map(function ($name) {
return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups);
})->flatten()->values()->all();

$middleware = collect($route->gatherMiddleware())->map(function ($name) {
$middleware = collect($computedMiddleware)->map(function ($name) {
return (array) MiddlewareNameResolver::resolve($name, $this->middleware, $this->middlewareGroups);
})->flatten()->reject(function ($name) use ($excluded) {
if (empty($excluded)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Facades/Broadcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* @method static \Illuminate\Broadcasting\Broadcasters\Broadcaster channel(string $channel, callable|string $callback, array $options = [])
* @method static mixed auth(\Illuminate\Http\Request $request)
* @method static void connection($name = null);
* @method static \Illuminate\Contracts\Broadcasting\Broadcaster connection($name = null);
* @method static void routes(array $attributes = null)
* @method static \Illuminate\Broadcasting\BroadcastManager socket($request = null)
*
Expand Down
6 changes: 4 additions & 2 deletions src/Illuminate/Support/Facades/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @method static bool isReadable(string $path)
* @method static bool isWritable(string $path)
* @method static bool makeDirectory(string $path, int $mode = 0755, bool $recursive = false, bool $force = false)
* @method static bool missing(string $path)
* @method static bool move(string $path, string $target)
* @method static bool moveDirectory(string $from, string $to, bool $overwrite = false)
* @method static int append(string $path, string $data)
Expand All @@ -27,8 +28,8 @@
* @method static int size(string $path)
* @method static int|bool put(string $path, string $contents, bool $lock = false)
* @method static mixed chmod(string $path, int|null $mode = null)
* @method static mixed getRequire(string $path)
* @method static mixed requireOnce(string $file)
* @method static mixed getRequire(string $path, array $data = [])
* @method static mixed requireOnce(string $file, array $data = [])
* @method static string basename(string $path)
* @method static string dirname(string $path)
* @method static string extension(string $path)
Expand All @@ -38,6 +39,7 @@
* @method static string sharedGet(string $path)
* @method static string type(string $path)
* @method static string|false mimeType(string $path)
* @method static string|null guessExtension(string $path)
* @method static void ensureDirectoryExists(string $path, int $mode = 0755, bool $recursive = true)
* @method static void link(string $target, string $link)
* @method static \Illuminate\Support\LazyCollection lines(string $path)
Expand Down
14 changes: 9 additions & 5 deletions src/Illuminate/Support/Facades/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
* @method static \Illuminate\Contracts\Filesystem\Filesystem assertExists(string|array $path)
* @method static \Illuminate\Contracts\Filesystem\Filesystem assertMissing(string|array $path)
* @method static \Illuminate\Contracts\Filesystem\Filesystem cloud()
* @method static \Illuminate\Contracts\Filesystem\Filesystem disk(string $name = null)
* @method static \Illuminate\Contracts\Filesystem\Filesystem disk(string|null $name = null)
* @method static \Illuminate\Filesystem\FilesystemManager extend(string $driver, \Closure $callback)
* @method static \Symfony\Component\HttpFoundation\StreamedResponse download(string $path, string|null $name = null, array|null $headers = [])
* @method static \Symfony\Component\HttpFoundation\StreamedResponse response(string $path, string|null $name = null, array|null $headers = [], string|null $disposition = 'inline')
* @method static array allDirectories(string|null $directory = null)
* @method static array allFiles(string|null $directory = null)
* @method static array directories(string|null $directory = null, bool $recursive = false)
Expand All @@ -18,23 +21,24 @@
* @method static bool delete(string|array $paths)
* @method static bool deleteDirectory(string $directory)
* @method static bool exists(string $path)
* @method static \Illuminate\Filesystem\FilesystemManager extend(string $driver, \Closure $callback)
* @method static bool makeDirectory(string $path)
* @method static bool missing(string $path)
* @method static bool move(string $from, string $to)
* @method static string path(string $path)
* @method static bool prepend(string $path, string $data)
* @method static bool put(string $path, string|resource $contents, mixed $options = [])
* @method static string|false putFile(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, mixed $options = [])
* @method static string|false putFileAs(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, string $name, mixed $options = [])
* @method static bool setVisibility(string $path, string $visibility)
* @method static bool writeStream(string $path, resource $resource, array $options = [])
* @method static int lastModified(string $path)
* @method static int size(string $path)
* @method static resource|null readStream(string $path)
* @method static string get(string $path)
* @method static string getVisibility(string $path)
* @method static string path(string $path)
* @method static string temporaryUrl(string $path, \DateTimeInterface $expiration, array $options = [])
* @method static string url(string $path)
* @method static string|false mimeType(string $path)
* @method static string|false putFile(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, mixed $options = [])
* @method static string|false putFileAs(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, string $name, mixed $options = [])
*
* @see \Illuminate\Filesystem\FilesystemManager
*/
Expand Down
16 changes: 14 additions & 2 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,16 @@ public static function camel($value)
*
* @param string $haystack
* @param string|string[] $needles
* @param bool $ignoreCase
* @return bool
*/
public static function contains($haystack, $needles)
public static function contains($haystack, $needles, $ignoreCase = false)
{
if ($ignoreCase) {
$haystack = mb_strtolower($haystack);
$needles = array_map('mb_strtolower', (array) $needles);
}

foreach ((array) $needles as $needle) {
if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
return true;
Expand All @@ -200,10 +206,16 @@ public static function contains($haystack, $needles)
*
* @param string $haystack
* @param string[] $needles
* @param bool $ignoreCase
* @return bool
*/
public static function containsAll($haystack, array $needles)
public static function containsAll($haystack, array $needles, $ignoreCase = false)
{
if ($ignoreCase) {
$haystack = mb_strtolower($haystack);
$needles = array_map('mb_strtolower', $needles);
}

foreach ($needles as $needle) {
if (! static::contains($haystack, $needle)) {
return false;
Expand Down
13 changes: 13 additions & 0 deletions src/Illuminate/Support/Stringable.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,19 @@ public function ucfirst()
return new static(Str::ucfirst($this->value));
}

/**
* Apply the callback's string changes if the given "value" is false.
*
* @param mixed $value
* @param callable $callback
* @param callable|null $default
* @return mixed|$this
*/
public function unless($value, $callback, $default = null)
{
return $this->when(! $value, $callback, $default);
}

/**
* Apply the callback's string changes if the given "value" is true.
*
Expand Down
12 changes: 6 additions & 6 deletions src/Illuminate/Validation/Concerns/ValidatesAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1540,9 +1540,9 @@ public function validateExcludeUnless($attribute, $value, $parameters)
{
$this->requireParameterCount(2, $parameters, 'exclude_unless');

if (! Arr::has($this->data, $parameters[0])) {
return true;
}
// if (! Arr::has($this->data, $parameters[0])) {
// return true;
// }

list($values, $other) = $this->parseDependentRuleParameters($parameters);

Expand All @@ -1561,9 +1561,9 @@ public function validateRequiredUnless($attribute, $value, $parameters)
{
$this->requireParameterCount(2, $parameters, 'required_unless');

if (! Arr::has($this->data, $parameters[0])) {
return true;
}
// if (! Arr::has($this->data, $parameters[0])) {
// return true;
// }

list($values, $other) = $this->parseDependentRuleParameters($parameters);

Expand Down
2 changes: 0 additions & 2 deletions tests/Cache/RedisCacheIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Cache\RedisStore;
use Illuminate\Cache\Repository;
use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis;
use Mockery as m;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -25,7 +24,6 @@ protected function tearDown()
{
parent::tearDown();
$this->tearDownRedis();
m::close();
}

/**
Expand Down
Loading

0 comments on commit 91bf4f1

Please sign in to comment.