Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Adds a few PHP 8.1 related changes #38404

Merged
merged 29 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e7f4e3d
Add ReturnTypeWillChange to SessionHandlerInterface usages
driesvints Aug 16, 2021
a08bf30
Bump commonmark
driesvints Aug 16, 2021
b38714a
Fix getIterator
driesvints Aug 16, 2021
0cd4ebe
Use Symfony 5.4 components
driesvints Aug 16, 2021
67ed703
Dev mockery
driesvints Aug 17, 2021
6c08d19
Mimic PHP 8.0
driesvints Aug 30, 2021
737eb83
Try removing symfony components
driesvints Aug 30, 2021
120af34
Mockery
driesvints Sep 2, 2021
ea94f26
Fix type errors in db tests (#38696)
GrahamCampbell Sep 7, 2021
38ae7a5
Additional DB test fixes (#38699)
GrahamCampbell Sep 7, 2021
133f434
More DB fixes (#38700)
GrahamCampbell Sep 7, 2021
d5b01d2
PHP 8.1 prefer-lowest builds
driesvints Sep 13, 2021
583ee53
Remove skipping PHP 8.1 builds
driesvints Sep 13, 2021
df7a737
Bump PHPUnit
driesvints Sep 13, 2021
c84446b
Revert "PHP 8.1 prefer-lowest builds"
driesvints Sep 13, 2021
15c4052
[8.x] Adds PHP 8.1 support to serializable closures (#38801)
nunomaduro Sep 14, 2021
2710084
Fix default value
driesvints Sep 14, 2021
b827e51
Fix mb_strlen value
driesvints Sep 14, 2021
f11d842
Adds `continue-on-error` for PHP 8.1
nunomaduro Sep 15, 2021
a8d5331
[8.x] Add explicit `@return` annotations in `{@inheritdoc}` from vend…
wouterj Sep 15, 2021
0944a60
Skips PHP 8.1 failing tests
nunomaduro Sep 15, 2021
2c9c83b
Skips some more PHP 8.1 related tests
nunomaduro Sep 15, 2021
145036f
Skips some more PHP 8.1 related tests
nunomaduro Sep 15, 2021
05cda8b
Skips some more PHP 8.1 related tests
nunomaduro Sep 15, 2021
593efcd
Skips some more PHP 8.1 related tests
nunomaduro Sep 15, 2021
abc7743
Skips some more PHP 8.1 related tests
nunomaduro Sep 15, 2021
1c77752
Skips some more PHP 8.1 related tests
nunomaduro Sep 15, 2021
8204179
Skips some more PHP 8.1 related tests
nunomaduro Sep 15, 2021
0f5e741
Update SerializableClosure.php
taylorotwell Sep 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
stability: [prefer-lowest, prefer-stable]
include:
- php: '8.1'
flags: "--ignore-platform-req=php"
stability: prefer-stable

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
Expand All @@ -57,6 +56,10 @@ jobs:
tools: composer:v2
coverage: none

- name: Mimic PHP 8.0
run: composer config platform.php 8.0.999
if: matrix.php > 8

- name: Set Minimum Guzzle Version
uses: nick-invision/retry@v1
with:
Expand All @@ -70,7 +73,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: Execute tests
continue-on-error: ${{ matrix.php > 8 }}
Expand All @@ -93,7 +96,6 @@ jobs:
stability: [prefer-lowest, prefer-stable]
include:
- php: '8.1'
flags: "--ignore-platform-req=php"
stability: prefer-stable

name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows
Expand All @@ -115,6 +117,10 @@ jobs:
tools: composer:v2
coverage: none

- name: Mimic PHP 8.0
run: composer config platform.php 8.0.999
if: matrix.php > 8

- name: Set Minimum Guzzle Version
uses: nick-invision/retry@v1
with:
Expand All @@ -128,8 +134,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: Execute tests
continue-on-error: ${{ matrix.php > 8 }}
run: vendor/bin/phpunit --verbose
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"doctrine/inflector": "^1.4|^2.0",
"dragonmantank/cron-expression": "^3.0.2",
"egulias/email-validator": "^2.1.10",
"league/commonmark": "^1.3|^2.0",
"laravel/serializable-closure": "^1.0",
"league/commonmark": "^1.3|^2.0.2",
"league/flysystem": "^1.1",
"monolog/monolog": "^2.0",
"nesbot/carbon": "^2.31",
Expand Down Expand Up @@ -79,14 +80,14 @@
},
"require-dev": {
"aws/aws-sdk-php": "^3.189.0",
"doctrine/dbal": "^2.6|^3.0",
"doctrine/dbal": "^2.13.3|^3.1.2",
"filp/whoops": "^2.8",
"guzzlehttp/guzzle": "^6.5.5|^7.0.1",
"league/flysystem-cached-adapter": "^1.0",
"mockery/mockery": "^1.4.2",
"mockery/mockery": "^1.4.4",
"orchestra/testbench-core": "^6.23",
"pda/pheanstalk": "^4.0",
"phpunit/phpunit": "^8.5.8|^9.3.3",
"phpunit/phpunit": "^8.5.19|^9.5.8",
"predis/predis": "^1.1.2",
"symfony/cache": "^5.1.4"
},
Expand Down Expand Up @@ -131,18 +132,18 @@
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.189.0).",
"brianium/paratest": "Required to run tests in parallel (^6.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.2).",
"filp/whoops": "Required for friendly error pages in development (^2.8).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
"guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.5.5|^7.0.1).",
"laravel/tinker": "Required to use the tinker console command (^2.0).",
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).",
"league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).",
"league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).",
"mockery/mockery": "Required to use mocking (^1.4.2).",
"mockery/mockery": "Required to use mocking (^1.4.4).",
"nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
"phpunit/phpunit": "Required to use assertions and run tests (^8.5.8|^9.3.3).",
"phpunit/phpunit": "Required to use assertions and run tests (^8.5.19|^9.5.8).",
"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 (^4.0|^5.0|^6.0).",
Expand Down
7 changes: 2 additions & 5 deletions src/Illuminate/Bus/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Contracts\Queue\Factory as QueueFactory;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Queue\CallQueuedClosure;
use Illuminate\Queue\SerializableClosure;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use JsonSerializable;
Expand Down Expand Up @@ -420,17 +419,15 @@ public function delete()
/**
* Invoke a batch callback handler.
*
* @param \Illuminate\Queue\SerializableClosure|callable $handler
* @param callable $handler
* @param \Illuminate\Bus\Batch $batch
* @param \Throwable|null $e
* @return void
*/
protected function invokeHandlerCallback($handler, Batch $batch, Throwable $e = null)
{
try {
return $handler instanceof SerializableClosure
? $handler->__invoke($batch, $e)
: call_user_func($handler, $batch, $e);
return $handler($batch, $e);
} catch (Throwable $e) {
if (function_exists('report')) {
report($e);
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Bus/PendingBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Bus\Events\BatchDispatched;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Events\Dispatcher as EventDispatcher;
use Illuminate\Queue\SerializableClosure;
use Illuminate\Queue\SerializableClosureFactory;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Throwable;
Expand Down Expand Up @@ -78,7 +78,7 @@ public function add($jobs)
public function then($callback)
{
$this->options['then'][] = $callback instanceof Closure
? new SerializableClosure($callback)
? SerializableClosureFactory::make($callback)
: $callback;

return $this;
Expand All @@ -103,7 +103,7 @@ public function thenCallbacks()
public function catch($callback)
{
$this->options['catch'][] = $callback instanceof Closure
? new SerializableClosure($callback)
? SerializableClosureFactory::make($callback)
: $callback;

return $this;
Expand All @@ -128,7 +128,7 @@ public function catchCallbacks()
public function finally($callback)
{
$this->options['finally'][] = $callback instanceof Closure
? new SerializableClosure($callback)
? SerializableClosureFactory::make($callback)
: $callback;

return $this;
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Bus/Queueable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Closure;
use Illuminate\Queue\CallQueuedClosure;
use Illuminate\Queue\SerializableClosure;
use Illuminate\Support\Arr;
use RuntimeException;

Expand Down Expand Up @@ -245,7 +244,7 @@ public function dispatchNextJobInChain()
public function invokeChainCatchCallbacks($e)
{
collect($this->chainCatchCallbacks)->each(function ($callback) use ($e) {
$callback instanceof SerializableClosure ? $callback->__invoke($e) : call_user_func($callback, $e);
$callback($e);
});
}
}
12 changes: 12 additions & 0 deletions src/Illuminate/Cache/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public function many(array $keys)

/**
* {@inheritdoc}
*
* @return iterable
*/
public function getMultiple($keys, $default = null)
{
Expand Down Expand Up @@ -219,6 +221,8 @@ public function put($key, $value, $ttl = null)

/**
* {@inheritdoc}
*
* @return bool
*/
public function set($key, $value, $ttl = null)
{
Expand Down Expand Up @@ -276,6 +280,8 @@ protected function putManyForever(array $values)

/**
* {@inheritdoc}
*
* @return bool
*/
public function setMultiple($values, $ttl = null)
{
Expand Down Expand Up @@ -439,6 +445,8 @@ public function forget($key)

/**
* {@inheritdoc}
*
* @return bool
*/
public function delete($key)
{
Expand All @@ -447,6 +455,8 @@ public function delete($key)

/**
* {@inheritdoc}
*
* @return bool
*/
public function deleteMultiple($keys)
{
Expand All @@ -463,6 +473,8 @@ public function deleteMultiple($keys)

/**
* {@inheritdoc}
*
* @return bool
*/
public function clear()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public function __construct(Container $laravel, Dispatcher $events, $version)

/**
* {@inheritdoc}
*
* @return int
*/
public function run(InputInterface $input = null, OutputInterface $output = null)
{
Expand Down
4 changes: 4 additions & 0 deletions src/Illuminate/Console/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ protected function resolveCommand($command)

/**
* {@inheritdoc}
*
* @return bool
*/
public function isHidden()
{
Expand All @@ -171,6 +173,8 @@ public function isHidden()

/**
* {@inheritdoc}
*
* @return static
*/
public function setHidden(bool $hidden)
{
Expand Down
8 changes: 6 additions & 2 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ public function bound($abstract)
}

/**
* {@inheritdoc}
* {@inheritdoc}
*
* @return bool
*/
public function has($id)
{
Expand Down Expand Up @@ -693,7 +695,9 @@ public function make($abstract, array $parameters = [])
}

/**
* {@inheritdoc}
* {@inheritdoc}
*
* @return mixed
*/
public function get($id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Container/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function getParameterClassName($parameter)
$type = $parameter->getType();

if (! $type instanceof ReflectionNamedType || $type->isBuiltin()) {
return;
return null;
}

$name = $type->getName();
Expand Down
4 changes: 4 additions & 0 deletions src/Illuminate/Database/DBAL/TimestampType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class TimestampType extends Type
{
/**
* {@inheritdoc}
*
* @return string
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
Expand Down Expand Up @@ -97,6 +99,8 @@ protected function getSQLitePlatformSQLDeclaration(array $fieldDeclaration)

/**
* {@inheritdoc}
*
* @return string
*/
public function getName()
{
Expand Down
3 changes: 3 additions & 0 deletions src/Illuminate/Database/PDO/SqlServerDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

class SqlServerDriver extends AbstractSQLServerDriver
{
/**
* @return \Doctrine\DBAL\Driver\Connection
*/
public function connect(array $params)
{
return new SqlServerConnection(
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
},
"suggest": {
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.2).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
"illuminate/console": "Required to use the database commands (^8.0).",
"illuminate/events": "Required to use the observers with Eloquent (^8.0).",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Encryption/Encrypter.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function decrypt($payload, $unserialize = true)
// we will then unserialize it and return it out to the caller. If we are
// unable to decrypt this value we will throw out an exception message.
$decrypted = \openssl_decrypt(
$payload['value'], strtolower($this->cipher), $this->key, 0, $iv, $tag
$payload['value'], strtolower($this->cipher), $this->key, 0, $iv, $tag ?? ''
);

if ($decrypted === false) {
Expand Down
24 changes: 23 additions & 1 deletion src/Illuminate/Encryption/EncryptionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Opis\Closure\SerializableClosure;
use Laravel\SerializableClosure\SerializableClosure;
use Opis\Closure\SerializableClosure as OpisSerializableClosure;

class EncryptionServiceProvider extends ServiceProvider
{
Expand All @@ -17,6 +18,7 @@ public function register()
{
$this->registerEncrypter();
$this->registerOpisSecurityKey();
$this->registerSerializableClosureSecurityKey();
}

/**
Expand All @@ -37,8 +39,28 @@ protected function registerEncrypter()
* Configure Opis Closure signing for security.
*
* @return void
*
* @deprecated Will be removed in a future Laravel version.
*/
protected function registerOpisSecurityKey()
{
if (\PHP_VERSION_ID < 80100) {
$config = $this->app->make('config')->get('app');

if (! class_exists(OpisSerializableClosure::class) || empty($config['key'])) {
return;
}

OpisSerializableClosure::setSecretKey($this->parseKey($config));
}
}

/**
* Configure Serializable Closure signing for security.
*
* @return void
*/
protected function registerSerializableClosureSecurityKey()
{
$config = $this->app->make('config')->get('app');

Expand Down
Loading