Skip to content

Commit 3e8f824

Browse files
authored
Merge pull request #2203 from nextcloud/carl/php-85-polyfill
feat: Add PHP 8.5 polyfill
2 parents a7473d3 + 8d5ec3f commit 3e8f824

File tree

12 files changed

+310
-1
lines changed

12 files changed

+310
-1
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"symfony/polyfill-php82": "^1.32.0",
6161
"symfony/polyfill-php83": "^1.32.0",
6262
"symfony/polyfill-php84": "^1.32.0",
63+
"symfony/polyfill-php85": "^1.33",
6364
"symfony/process": "^6.4.15",
6465
"symfony/routing": "^6.4.12",
6566
"symfony/translation": "^6.4.4",

composer.lock

Lines changed: 81 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer/autoload_classmap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,7 @@
13181318
'MicrosoftAzure\\Storage\\Common\\Models\\TransactionalMD5Trait' => $vendorDir . '/microsoft/azure-storage-common/src/Common/Models/TransactionalMD5Trait.php',
13191319
'MicrosoftAzure\\Storage\\Common\\SharedAccessSignatureHelper' => $vendorDir . '/microsoft/azure-storage-common/src/Common/SharedAccessSignatureHelper.php',
13201320
'Nextcloud\\LogNormalizer\\Normalizer' => $vendorDir . '/nextcloud/lognormalizer/src/Normalizer.php',
1321+
'NoDiscard' => $vendorDir . '/symfony/polyfill-php85/Resources/stubs/NoDiscard.php',
13211322
'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
13221323
'OS_Guess' => $vendorDir . '/pear/pear-core-minimal/src/OS/Guess.php',
13231324
'OpenStack\\BlockStorage\\v2\\Api' => $vendorDir . '/php-opencloud/openstack/src/BlockStorage/v2/Api.php',
@@ -2879,6 +2880,7 @@
28792880
'Symfony\\Polyfill\\Intl\\Normalizer\\Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Normalizer.php',
28802881
'Symfony\\Polyfill\\Php83\\Php83' => $vendorDir . '/symfony/polyfill-php83/Php83.php',
28812882
'Symfony\\Polyfill\\Php84\\Php84' => $vendorDir . '/symfony/polyfill-php84/Php84.php',
2883+
'Symfony\\Polyfill\\Php85\\Php85' => $vendorDir . '/symfony/polyfill-php85/Php85.php',
28822884
'Symfony\\Polyfill\\Uuid\\Uuid' => $vendorDir . '/symfony/polyfill-uuid/Uuid.php',
28832885
'System' => $vendorDir . '/pear/pear-core-minimal/src/System.php',
28842886
'Webauthn\\AttestationStatement\\AndroidKeyAttestationStatementSupport' => $vendorDir . '/web-auth/webauthn-lib/src/AttestationStatement/AndroidKeyAttestationStatementSupport.php',

composer/autoload_files.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
'8a9dc1de0ca7e01f3e08231539562f61' => $vendorDir . '/aws/aws-sdk-php/src/functions.php',
2727
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
2828
'9d2b9fc6db0f153a0a149fefb182415e' => $vendorDir . '/symfony/polyfill-php84/bootstrap.php',
29+
'606a39d89246991a373564698c2d8383' => $vendorDir . '/symfony/polyfill-php85/bootstrap.php',
2930
'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php',
3031
);

composer/autoload_psr4.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'ZipStreamer\\' => array($vendorDir . '/deepdiver/zipstreamer/src'),
1717
'Webauthn\\' => array($vendorDir . '/web-auth/webauthn-lib/src'),
1818
'Symfony\\Polyfill\\Uuid\\' => array($vendorDir . '/symfony/polyfill-uuid'),
19+
'Symfony\\Polyfill\\Php85\\' => array($vendorDir . '/symfony/polyfill-php85'),
1920
'Symfony\\Polyfill\\Php84\\' => array($vendorDir . '/symfony/polyfill-php84'),
2021
'Symfony\\Polyfill\\Php83\\' => array($vendorDir . '/symfony/polyfill-php83'),
2122
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),

composer/autoload_static.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652
2727
'8a9dc1de0ca7e01f3e08231539562f61' => __DIR__ . '/..' . '/aws/aws-sdk-php/src/functions.php',
2828
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
2929
'9d2b9fc6db0f153a0a149fefb182415e' => __DIR__ . '/..' . '/symfony/polyfill-php84/bootstrap.php',
30+
'606a39d89246991a373564698c2d8383' => __DIR__ . '/..' . '/symfony/polyfill-php85/bootstrap.php',
3031
'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php',
3132
);
3233

@@ -70,6 +71,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652
7071
'S' =>
7172
array (
7273
'Symfony\\Polyfill\\Uuid\\' => 22,
74+
'Symfony\\Polyfill\\Php85\\' => 23,
7375
'Symfony\\Polyfill\\Php84\\' => 23,
7476
'Symfony\\Polyfill\\Php83\\' => 23,
7577
'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
@@ -227,6 +229,10 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652
227229
array (
228230
0 => __DIR__ . '/..' . '/symfony/polyfill-uuid',
229231
),
232+
'Symfony\\Polyfill\\Php85\\' =>
233+
array (
234+
0 => __DIR__ . '/..' . '/symfony/polyfill-php85',
235+
),
230236
'Symfony\\Polyfill\\Php84\\' =>
231237
array (
232238
0 => __DIR__ . '/..' . '/symfony/polyfill-php84',
@@ -1839,6 +1845,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652
18391845
'MicrosoftAzure\\Storage\\Common\\Models\\TransactionalMD5Trait' => __DIR__ . '/..' . '/microsoft/azure-storage-common/src/Common/Models/TransactionalMD5Trait.php',
18401846
'MicrosoftAzure\\Storage\\Common\\SharedAccessSignatureHelper' => __DIR__ . '/..' . '/microsoft/azure-storage-common/src/Common/SharedAccessSignatureHelper.php',
18411847
'Nextcloud\\LogNormalizer\\Normalizer' => __DIR__ . '/..' . '/nextcloud/lognormalizer/src/Normalizer.php',
1848+
'NoDiscard' => __DIR__ . '/..' . '/symfony/polyfill-php85/Resources/stubs/NoDiscard.php',
18421849
'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
18431850
'OS_Guess' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/OS/Guess.php',
18441851
'OpenStack\\BlockStorage\\v2\\Api' => __DIR__ . '/..' . '/php-opencloud/openstack/src/BlockStorage/v2/Api.php',
@@ -3400,6 +3407,7 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652
34003407
'Symfony\\Polyfill\\Intl\\Normalizer\\Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Normalizer.php',
34013408
'Symfony\\Polyfill\\Php83\\Php83' => __DIR__ . '/..' . '/symfony/polyfill-php83/Php83.php',
34023409
'Symfony\\Polyfill\\Php84\\Php84' => __DIR__ . '/..' . '/symfony/polyfill-php84/Php84.php',
3410+
'Symfony\\Polyfill\\Php85\\Php85' => __DIR__ . '/..' . '/symfony/polyfill-php85/Php85.php',
34033411
'Symfony\\Polyfill\\Uuid\\Uuid' => __DIR__ . '/..' . '/symfony/polyfill-uuid/Uuid.php',
34043412
'System' => __DIR__ . '/..' . '/pear/pear-core-minimal/src/System.php',
34053413
'Webauthn\\AttestationStatement\\AndroidKeyAttestationStatementSupport' => __DIR__ . '/..' . '/web-auth/webauthn-lib/src/AttestationStatement/AndroidKeyAttestationStatementSupport.php',

composer/installed.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5496,6 +5496,89 @@
54965496
],
54975497
"install-path": "../symfony/polyfill-php84"
54985498
},
5499+
{
5500+
"name": "symfony/polyfill-php85",
5501+
"version": "v1.33.0",
5502+
"version_normalized": "1.33.0.0",
5503+
"source": {
5504+
"type": "git",
5505+
"url": "https://github.com/symfony/polyfill-php85.git",
5506+
"reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91"
5507+
},
5508+
"dist": {
5509+
"type": "zip",
5510+
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91",
5511+
"reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91",
5512+
"shasum": ""
5513+
},
5514+
"require": {
5515+
"php": ">=7.2"
5516+
},
5517+
"time": "2025-06-23T16:12:55+00:00",
5518+
"type": "library",
5519+
"extra": {
5520+
"thanks": {
5521+
"url": "https://github.com/symfony/polyfill",
5522+
"name": "symfony/polyfill"
5523+
}
5524+
},
5525+
"installation-source": "dist",
5526+
"autoload": {
5527+
"files": [
5528+
"bootstrap.php"
5529+
],
5530+
"psr-4": {
5531+
"Symfony\\Polyfill\\Php85\\": ""
5532+
},
5533+
"classmap": [
5534+
"Resources/stubs"
5535+
]
5536+
},
5537+
"notification-url": "https://packagist.org/downloads/",
5538+
"license": [
5539+
"MIT"
5540+
],
5541+
"authors": [
5542+
{
5543+
"name": "Nicolas Grekas",
5544+
"email": "[email protected]"
5545+
},
5546+
{
5547+
"name": "Symfony Community",
5548+
"homepage": "https://symfony.com/contributors"
5549+
}
5550+
],
5551+
"description": "Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions",
5552+
"homepage": "https://symfony.com",
5553+
"keywords": [
5554+
"compatibility",
5555+
"polyfill",
5556+
"portable",
5557+
"shim"
5558+
],
5559+
"support": {
5560+
"source": "https://github.com/symfony/polyfill-php85/tree/v1.33.0"
5561+
},
5562+
"funding": [
5563+
{
5564+
"url": "https://symfony.com/sponsor",
5565+
"type": "custom"
5566+
},
5567+
{
5568+
"url": "https://github.com/fabpot",
5569+
"type": "github"
5570+
},
5571+
{
5572+
"url": "https://github.com/nicolas-grekas",
5573+
"type": "github"
5574+
},
5575+
{
5576+
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
5577+
"type": "tidelift"
5578+
}
5579+
],
5580+
"install-path": "../symfony/polyfill-php85"
5581+
},
54995582
{
55005583
"name": "symfony/polyfill-uuid",
55015584
"version": "v1.29.0",

composer/installed.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,15 @@
814814
'aliases' => array(),
815815
'dev_requirement' => false,
816816
),
817+
'symfony/polyfill-php85' => array(
818+
'pretty_version' => 'v1.33.0',
819+
'version' => '1.33.0.0',
820+
'reference' => 'd4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91',
821+
'type' => 'library',
822+
'install_path' => __DIR__ . '/../symfony/polyfill-php85',
823+
'aliases' => array(),
824+
'dev_requirement' => false,
825+
),
817826
'symfony/polyfill-uuid' => array(
818827
'pretty_version' => 'v1.29.0',
819828
'version' => '1.29.0.0',

symfony/polyfill-php85/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2025-present Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

symfony/polyfill-php85/Php85.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Polyfill\Php85;
13+
14+
/**
15+
* @author Pierre Ambroise <[email protected]>
16+
*
17+
* @internal
18+
*/
19+
final class Php85
20+
{
21+
public static function get_error_handler(): ?callable
22+
{
23+
$handler = set_error_handler(null);
24+
restore_error_handler();
25+
26+
return $handler;
27+
}
28+
29+
public static function get_exception_handler(): ?callable
30+
{
31+
$handler = set_exception_handler(null);
32+
restore_exception_handler();
33+
34+
return $handler;
35+
}
36+
37+
public static function array_first(array $array)
38+
{
39+
foreach ($array as $value) {
40+
return $value;
41+
}
42+
43+
return null;
44+
}
45+
46+
public static function array_last(array $array)
47+
{
48+
return $array ? current(array_slice($array, -1)) : null;
49+
}
50+
}

0 commit comments

Comments
 (0)