-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
PHP 8.1 Support #353
PHP 8.1 Support #353
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #353 +/- ##
==========================================
Coverage 99.46% 99.46%
Complexity 359 359
==========================================
Files 68 68
Lines 927 929 +2
==========================================
+ Hits 922 924 +2
Misses 5 5
Continue to review full report at Codecov.
|
Checking the full stacktrace (formatted below) reveals protected function registerOpisSecurityKey()
{
if (Str::startsWith($key = $this->app['config']->get('app.key'), 'base64:')) {
$key = base64_decode(substr($key, 7));
}
SerializableClosure::setSecretKey($key);
} This appears to have been removed since 7.x, but the root cause of the issue is Stacktrace from the Laravel log:
|
ddced2c
to
2bb5d80
Compare
664252c
to
8a55300
Compare
This should fix an ErrorException in the `QueueServiceProvider`, which attempts to use the `app.key` value from config as the first param of its call to `Str::startsWith()`. Because it defaults to `null`, we get a deprecation error on PHP 8.1 which Laravel transforms to an exception.
PHP CS Fixer doesn't officially support PHP 8.1 yet, so it throws a warning instead. It appears to run fine however, so we tell it not to pay attention to the PHP version if it's one it doesn't support.
Not sure why other versions aren't affected, but on PHP 8.1 all the Servidor\Database (i.e. `Doctrine\DBAL`) tests fail because of an HY000 "No such file or directory" error, presumably due to the lack of a host.
* Bumps laravel for validation/rule-formatter fix in [8.34.0][1] * Bumps Sanctum for stateful middleware fix in [2.9.1][2] [1]: https://github.com/laravel/framework/releases/tag/v8.34.0 [2]: https://github.com/laravel/sanctum/releases/tag/v2.9.1
Version 2.9.3 includes laravel/sanctum#264 which introduces a new null-passing error in the updated sanctum.stateful config value, which assumes the `APP_URL` env var is set. We only set url in config, so even though we have our own config/sanctum.php, the default file is included in CI because config can't be cached before composer install was run.
Macroable v2 was being required because I'm running install on php8, but it drops support for php 7 entirely thus breaking install on 7.4. Although spatie/ray allows v1 *or* v2, composer doesn't seem to want to try for v1 on 7.4 even when I explicitly add it to the composer.json so instead of messing about this just locks it to 1.x, since php8 support has been added since 1.0.1 anyway so it's probably fine.
543354a
to
b113007
Compare
In v8.32.0, laravel/framework#36504 was merged which fixes null being treated as true by the validator, but also enforces strict checking for boolean values given to the required_unless rule. That's not necessarily a bad thing, it just means we can't be passing `1` when we want `true`. When we use `1`, user tests fail because while we pass `'user_group' => true` in the request data, the validator checks explicitly for `1` which it doesn't see, so it says "gid is required unless user group is in 1". We don't want that.
Fixues a bunch of "null as string" deprecation errors in PHP 8.1, and updates dependencies to latest.
Temporary Exception Overrides
Both laravel/framework and laravel/sanctum throw deprecation warnings that get transformed into exceptions in tests. Forked and fixed, but PRs currently pending.
Laravel
Triggers the warning when messages for a validation rule are formatted, and
getDisplayableValue()
returnsnull
when it's passed tostr_replace()
.Sanctum
Triggers it in the
EnsureFrontendRequestsAreStateful
middleware when a request lacks both aReferer
and anOrigin
header. This breaks all tests that hit frontend routes.Laravel also threw warnings on 6.x (or just 7? need to double check) for any routes defined without a prefix, which included the default routes used by Passport. This no longer applies here, but it's unclear whether that's because Passport was switched for Sanctum, or because Symfony packages were also updated.
Deprecation Warnings
Less important, since these can largely be ignored and won't prevent things from running.
JSON Schema
Calls
strlen()
inJsonSchema\Constraints\Constraint
. Required by Composer, fix pending in jsonrainbow/json-schema#657.Composer
Calls
preg_replace()
inComposer\Autoload\ClassMapGenerator
at line 251