Skip to content

Commit 1ad807a

Browse files
[8.x] PHP 8.1 Support (#39034)
* Remove platform requirement * Enable prefer-lowest builds for PHP 8.1 * Bump whoops * Minimum symfony version * Bump carbon * Try dev * Require commonmark * Add phpunit * Bump predis * More clearly describe failing mail tests * Remove skips for Redis tests * try predis dev * Make ArgonHasher aware of argon provider (#39046) * Make ArgonHasher aware of argon provider If sodium provides the argon2 then threads must be 1, if "standard" (libargon2) is the provider it can be 1 or 2. Not sure why this seems to only affect PHP 8.1 however as the behaviour seems to date back quite a bit. https://github.com/php/php-src/blob/2a3760a2d12b1a4c5c0207386b6cae84e404ee7e/ext/sodium/sodium_pwhash.c#L197 * remove skips for Hashing tests * Enable tests * Re-skip test * Adjust skips * Re-enable dynamodb tests * Bump predis * Bump PHP AWS SDK * Remove test skipping * Update tests.yml * Update tests.yml * Bump SwiftMailer * string fallbacks * Update phpunit.xml.dist * Remove skips Co-authored-by: Dan <[email protected]>
1 parent a6ef21a commit 1ad807a

18 files changed

+41
-108
lines changed

.github/workflows/tests.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ jobs:
3636
strategy:
3737
fail-fast: true
3838
matrix:
39-
php: ['7.3', '7.4', '8.0']
39+
php: ['7.3', '7.4', '8.0', '8.1']
4040
stability: [prefer-lowest, prefer-stable]
41-
include:
42-
- php: '8.1'
43-
stability: prefer-stable
4441

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

@@ -56,18 +53,22 @@ jobs:
5653
tools: composer:v2
5754
coverage: none
5855

59-
- name: Mimic PHP 8.0
60-
run: composer config platform.php 8.0.999
61-
if: matrix.php > 8
62-
63-
- name: Set Minimum Guzzle Version
56+
- name: Set Minimum PHP 8.0 Versions
6457
uses: nick-invision/retry@v1
6558
with:
6659
timeout_minutes: 5
6760
max_attempts: 5
6861
command: composer require guzzlehttp/guzzle:^7.2 --no-interaction --no-update
6962
if: matrix.php >= 8
7063

64+
- name: Set Minimum PHP 8.1 Versions
65+
uses: nick-invision/retry@v1
66+
with:
67+
timeout_minutes: 5
68+
max_attempts: 5
69+
command: composer require symfony/symfony:5.4.x-dev league/commonmark:^2.0.2 phpunit/phpunit:^9.5.8 --no-interaction --no-update
70+
if: matrix.php >= 8.1
71+
7172
- name: Install dependencies
7273
uses: nick-invision/retry@v1
7374
with:
@@ -99,11 +100,8 @@ jobs:
99100
strategy:
100101
fail-fast: true
101102
matrix:
102-
php: ['7.3', '7.4', '8.0']
103+
php: ['7.3', '7.4', '8.0', '8.1']
103104
stability: [prefer-lowest, prefer-stable]
104-
include:
105-
- php: '8.1'
106-
stability: prefer-stable
107105

108106
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows
109107

@@ -124,18 +122,22 @@ jobs:
124122
tools: composer:v2
125123
coverage: none
126124

127-
- name: Mimic PHP 8.0
128-
run: composer config platform.php 8.0.999
129-
if: matrix.php > 8
130-
131-
- name: Set Minimum Guzzle Version
125+
- name: Set Minimum PHP 8.0 Versions
132126
uses: nick-invision/retry@v1
133127
with:
134128
timeout_minutes: 5
135129
max_attempts: 5
136130
command: composer require guzzlehttp/guzzle:^7.2 --no-interaction --no-update
137131
if: matrix.php >= 8
138132

133+
- name: Set Minimum PHP 8.1 Versions
134+
uses: nick-invision/retry@v1
135+
with:
136+
timeout_minutes: 5
137+
max_attempts: 5
138+
command: composer require symfony/symfony:5.4.x-dev league/commonmark:^2.0.2 phpunit/phpunit:^9.5.8 --no-interaction --no-update
139+
if: matrix.php >= 8.1
140+
139141
- name: Install dependencies
140142
uses: nick-invision/retry@v1
141143
with:

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
"league/commonmark": "^1.3|^2.0.2",
2727
"league/flysystem": "^1.1",
2828
"monolog/monolog": "^2.0",
29-
"nesbot/carbon": "^2.31",
29+
"nesbot/carbon": "^2.53.1",
3030
"opis/closure": "^3.6",
3131
"psr/container": "^1.0",
3232
"psr/log": "^1.0 || ^2.0",
3333
"psr/simple-cache": "^1.0",
3434
"ramsey/uuid": "^4.2.2",
35-
"swiftmailer/swiftmailer": "^6.0",
35+
"swiftmailer/swiftmailer": "^6.3",
3636
"symfony/console": "^5.1.4",
3737
"symfony/error-handler": "^5.1.4",
3838
"symfony/finder": "^5.1.4",
@@ -80,16 +80,16 @@
8080
"illuminate/view": "self.version"
8181
},
8282
"require-dev": {
83-
"aws/aws-sdk-php": "^3.189.0",
83+
"aws/aws-sdk-php": "^3.198.1",
8484
"doctrine/dbal": "^2.13.3|^3.1.2",
85-
"filp/whoops": "^2.8",
85+
"filp/whoops": "^2.14.3",
8686
"guzzlehttp/guzzle": "^6.5.5|^7.0.1",
8787
"league/flysystem-cached-adapter": "^1.0",
8888
"mockery/mockery": "^1.4.4",
8989
"orchestra/testbench-core": "^6.23",
9090
"pda/pheanstalk": "^4.0",
9191
"phpunit/phpunit": "^8.5.19|^9.5.8",
92-
"predis/predis": "^1.1.2",
92+
"predis/predis": "^1.1.9",
9393
"symfony/cache": "^5.1.4"
9494
},
9595
"provide": {
@@ -131,10 +131,10 @@
131131
"ext-pcntl": "Required to use all features of the queue worker.",
132132
"ext-posix": "Required to use all features of the queue worker.",
133133
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
134-
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.189.0).",
134+
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.198.1).",
135135
"brianium/paratest": "Required to run tests in parallel (^6.0).",
136136
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.2).",
137-
"filp/whoops": "Required for friendly error pages in development (^2.8).",
137+
"filp/whoops": "Required for friendly error pages in development (^2.14.3).",
138138
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
139139
"guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.5.5|^7.0.1).",
140140
"laravel/tinker": "Required to use the tinker console command (^2.0).",
@@ -145,7 +145,7 @@
145145
"nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
146146
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
147147
"phpunit/phpunit": "Required to use assertions and run tests (^8.5.19|^9.5.8).",
148-
"predis/predis": "Required to use the predis connector (^1.1.2).",
148+
"predis/predis": "Required to use the predis connector (^1.1.9).",
149149
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
150150
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0|^5.0|^6.0).",
151151
"symfony/cache": "Required to PSR-6 cache bridge (^5.1.4).",

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
backupStaticAttributes="false"
44
beStrictAboutTestsThatDoNotTestAnything="false"
55
colors="true"
6+
convertDeprecationsToExceptions="true"
67
convertErrorsToExceptions="true"
78
convertNoticesToExceptions="true"
89
convertWarningsToExceptions="true"

src/Illuminate/Filesystem/FilesystemAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ protected function replaceBaseUrl($uri, $url)
651651
*/
652652
public function files($directory = null, $recursive = false)
653653
{
654-
$contents = $this->driver->listContents($directory, $recursive);
654+
$contents = $this->driver->listContents($directory ?? '', $recursive);
655655

656656
return $this->filterContentsByType($contents, 'file');
657657
}
@@ -676,7 +676,7 @@ public function allFiles($directory = null)
676676
*/
677677
public function directories($directory = null, $recursive = false)
678678
{
679-
$contents = $this->driver->listContents($directory, $recursive);
679+
$contents = $this->driver->listContents($directory ?? '', $recursive);
680680

681681
return $this->filterContentsByType($contents, 'dir');
682682
}

src/Illuminate/Hashing/ArgonHasher.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(array $options = [])
4545
{
4646
$this->time = $options['time'] ?? $this->time;
4747
$this->memory = $options['memory'] ?? $this->memory;
48-
$this->threads = $options['threads'] ?? $this->threads;
48+
$this->threads = $this->threads($options);
4949
$this->verifyAlgorithm = $options['verify'] ?? $this->verifyAlgorithm;
5050
}
5151

@@ -187,6 +187,10 @@ protected function time(array $options)
187187
*/
188188
protected function threads(array $options)
189189
{
190+
if (defined('PASSWORD_ARGON2_PROVIDER') && PASSWORD_ARGON2_PROVIDER === 'sodium') {
191+
return 1;
192+
}
193+
190194
return $options['threads'] ?? $this->threads;
191195
}
192196
}

src/Illuminate/Mail/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"illuminate/support": "^8.0",
2424
"league/commonmark": "^1.3|^2.0.2",
2525
"psr/log": "^1.0",
26-
"swiftmailer/swiftmailer": "^6.0",
26+
"swiftmailer/swiftmailer": "^6.3",
2727
"tijsverkoyen/css-to-inline-styles": "^2.2.2"
2828
},
2929
"autoload": {
@@ -37,7 +37,7 @@
3737
}
3838
},
3939
"suggest": {
40-
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.189.0).",
40+
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.198.1).",
4141
"guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^6.5.5|^7.0.1).",
4242
"wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)."
4343
},

src/Illuminate/Queue/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"suggest": {
4343
"ext-pcntl": "Required to use all features of the queue worker.",
4444
"ext-posix": "Required to use all features of the queue worker.",
45-
"aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.189.0).",
45+
"aws/aws-sdk-php": "Required to use the SQS queue driver and DynamoDb failed job storage (^3.198.1).",
4646
"illuminate/redis": "Required to use the Redis queue driver (^8.0).",
4747
"pda/pheanstalk": "Required to use the Beanstalk queue driver (^4.0)."
4848
},

src/Illuminate/Redis/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"suggest": {
2929
"ext-redis": "Required to use the phpredis connector (^4.0|^5.0).",
30-
"predis/predis": "Required to use the predis connector (^1.1.2)."
30+
"predis/predis": "Required to use the predis connector (^1.1.9)."
3131
},
3232
"extra": {
3333
"branch-alias": {

src/Illuminate/Support/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"illuminate/collections": "^8.0",
2222
"illuminate/contracts": "^8.0",
2323
"illuminate/macroable": "^8.0",
24-
"nesbot/carbon": "^2.31",
24+
"nesbot/carbon": "^2.53.1",
2525
"voku/portable-ascii": "^1.4.8"
2626
},
2727
"conflict": {

tests/Hashing/HasherTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ public function testBasicBcryptHashing()
2323

2424
public function testBasicArgon2iHashing()
2525
{
26-
if (\PHP_VERSION_ID >= 80100) {
27-
$this->markTestSkipped('Test failing in PHP 8.1');
28-
}
29-
3026
if (! defined('PASSWORD_ARGON2I')) {
3127
$this->markTestSkipped('PHP not compiled with Argon2i hashing support.');
3228
}
@@ -42,10 +38,6 @@ public function testBasicArgon2iHashing()
4238

4339
public function testBasicArgon2idHashing()
4440
{
45-
if (\PHP_VERSION_ID >= 80100) {
46-
$this->markTestSkipped('Test failing in PHP 8.1');
47-
}
48-
4941
if (! defined('PASSWORD_ARGON2ID')) {
5042
$this->markTestSkipped('PHP not compiled with Argon2id hashing support.');
5143
}
@@ -64,10 +56,6 @@ public function testBasicArgon2idHashing()
6456
*/
6557
public function testBasicBcryptVerification()
6658
{
67-
if (\PHP_VERSION_ID >= 80100) {
68-
$this->markTestSkipped('Test failing in PHP 8.1');
69-
}
70-
7159
$this->expectException(RuntimeException::class);
7260

7361
if (! defined('PASSWORD_ARGON2I')) {

0 commit comments

Comments
 (0)