Skip to content

Commit a7f0f5d

Browse files
Merge pull request #1387 from nextcloud/bump/guzzle-psr7/stable26
[stable26] sec(deps): Update guzzlehttp/psr7
2 parents 0ec7363 + 6573b68 commit a7f0f5d

File tree

12 files changed

+124
-49
lines changed

12 files changed

+124
-49
lines changed

.github/workflows/lint-php.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint php
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: lint-php-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
php-lint:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
php-versions: [ "8.0", "8.1", "8.2" ]
29+
30+
name: php-lint
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
35+
36+
- name: Set up php ${{ matrix.php-versions }}
37+
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
38+
with:
39+
php-version: ${{ matrix.php-versions }}
40+
coverage: none
41+
ini-file: development
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Lint
46+
run: composer run lint
47+
48+
summary:
49+
permissions:
50+
contents: none
51+
runs-on: ubuntu-latest
52+
needs: php-lint
53+
54+
if: always()
55+
56+
name: php-lint-summary
57+
58+
steps:
59+
- name: Summary status
60+
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
"symfony/translation": "^4.4.41",
6363
"web-auth/webauthn-lib": "^3.1"
6464
},
65+
"scripts": {
66+
"lint": "find . -name \\*.php -print0 | xargs -0 -n1 php -l"
67+
},
6568
"extra": {
6669
"patches-file": "composer.patches.json"
6770
}

composer.lock

Lines changed: 6 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer/ClassLoader.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ public function unregister()
429429
public function loadClass($class)
430430
{
431431
if ($file = $this->findFile($class)) {
432-
(self::$includeFile)($file);
432+
$includeFile = self::$includeFile;
433+
$includeFile($file);
433434

434435
return true;
435436
}
@@ -560,7 +561,10 @@ private function findFileWithExtension($class, $ext)
560561
return false;
561562
}
562563

563-
private static function initializeIncludeClosure(): void
564+
/**
565+
* @return void
566+
*/
567+
private static function initializeIncludeClosure()
564568
{
565569
if (self::$includeFile !== null) {
566570
return;
@@ -574,8 +578,8 @@ private static function initializeIncludeClosure(): void
574578
* @param string $file
575579
* @return void
576580
*/
577-
self::$includeFile = static function($file) {
581+
self::$includeFile = \Closure::bind(static function($file) {
578582
include $file;
579-
};
583+
}, null, null);
580584
}
581585
}

composer/InstalledVersions.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true)
9898
{
9999
foreach (self::getInstalled() as $installed) {
100100
if (isset($installed['versions'][$packageName])) {
101-
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
101+
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
102102
}
103103
}
104104

@@ -119,7 +119,7 @@ public static function isInstalled($packageName, $includeDevRequirements = true)
119119
*/
120120
public static function satisfies(VersionParser $parser, $packageName, $constraint)
121121
{
122-
$constraint = $parser->parseConstraints($constraint);
122+
$constraint = $parser->parseConstraints((string) $constraint);
123123
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
124124

125125
return $provided->matches($constraint);
@@ -328,7 +328,9 @@ private static function getInstalled()
328328
if (isset(self::$installedByVendor[$vendorDir])) {
329329
$installed[] = self::$installedByVendor[$vendorDir];
330330
} elseif (is_file($vendorDir.'/composer/installed.php')) {
331-
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
331+
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
332+
$required = require $vendorDir.'/composer/installed.php';
333+
$installed[] = self::$installedByVendor[$vendorDir] = $required;
332334
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
333335
self::$installed = $installed[count($installed) - 1];
334336
}
@@ -340,12 +342,17 @@ private static function getInstalled()
340342
// only require the installed.php file if this file is loaded from its dumped location,
341343
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
342344
if (substr(__DIR__, -8, 1) !== 'C') {
343-
self::$installed = require __DIR__ . '/installed.php';
345+
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
346+
$required = require __DIR__ . '/installed.php';
347+
self::$installed = $required;
344348
} else {
345349
self::$installed = array();
346350
}
347351
}
348-
$installed[] = self::$installed;
352+
353+
if (self::$installed !== array()) {
354+
$installed[] = self::$installed;
355+
}
349356

350357
return $installed;
351358
}

composer/autoload_real.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ public static function getLoader()
3939
$loader->register(true);
4040

4141
$filesToLoad = \Composer\Autoload\ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652::$files;
42-
$requireFile = static function ($fileIdentifier, $file) {
42+
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
4343
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
4444
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
4545

4646
require $file;
4747
}
48-
};
48+
}, null, null);
4949
foreach ($filesToLoad as $fileIdentifier => $file) {
50-
($requireFile)($fileIdentifier, $file);
50+
$requireFile($fileIdentifier, $file);
5151
}
5252

5353
return $loader;

composer/installed.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,17 +1564,17 @@
15641564
},
15651565
{
15661566
"name": "guzzlehttp/psr7",
1567-
"version": "2.4.3",
1568-
"version_normalized": "2.4.3.0",
1567+
"version": "2.4.5",
1568+
"version_normalized": "2.4.5.0",
15691569
"source": {
15701570
"type": "git",
15711571
"url": "https://github.com/guzzle/psr7.git",
1572-
"reference": "67c26b443f348a51926030c83481b85718457d3d"
1572+
"reference": "0454e12ef0cd597ccd2adb036f7bda4e7fface66"
15731573
},
15741574
"dist": {
15751575
"type": "zip",
1576-
"url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d",
1577-
"reference": "67c26b443f348a51926030c83481b85718457d3d",
1576+
"url": "https://api.github.com/repos/guzzle/psr7/zipball/0454e12ef0cd597ccd2adb036f7bda4e7fface66",
1577+
"reference": "0454e12ef0cd597ccd2adb036f7bda4e7fface66",
15781578
"shasum": ""
15791579
},
15801580
"require": {
@@ -1595,15 +1595,12 @@
15951595
"suggest": {
15961596
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
15971597
},
1598-
"time": "2022-10-26T14:07:24+00:00",
1598+
"time": "2023-04-17T16:00:45+00:00",
15991599
"type": "library",
16001600
"extra": {
16011601
"bamarni-bin": {
16021602
"bin-links": true,
16031603
"forward-command": false
1604-
},
1605-
"branch-alias": {
1606-
"dev-master": "2.4-dev"
16071604
}
16081605
},
16091606
"installation-source": "dist",
@@ -1666,7 +1663,7 @@
16661663
],
16671664
"support": {
16681665
"issues": "https://github.com/guzzle/psr7/issues",
1669-
"source": "https://github.com/guzzle/psr7/tree/2.4.3"
1666+
"source": "https://github.com/guzzle/psr7/tree/2.4.5"
16701667
},
16711668
"funding": [
16721669
{

composer/installed.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name' => 'nextcloud/3rdparty',
44
'pretty_version' => 'dev-master',
55
'version' => 'dev-master',
6-
'reference' => '7290f9d6d76016c7a6c06f0e58a780101df3fc41',
6+
'reference' => '99ada0cd457b20fcadefef7a9c8f465a638dcb53',
77
'type' => 'library',
88
'install_path' => __DIR__ . '/../',
99
'aliases' => array(),
@@ -209,9 +209,9 @@
209209
'dev_requirement' => false,
210210
),
211211
'guzzlehttp/psr7' => array(
212-
'pretty_version' => '2.4.3',
213-
'version' => '2.4.3.0',
214-
'reference' => '67c26b443f348a51926030c83481b85718457d3d',
212+
'pretty_version' => '2.4.5',
213+
'version' => '2.4.5.0',
214+
'reference' => '0454e12ef0cd597ccd2adb036f7bda4e7fface66',
215215
'type' => 'library',
216216
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
217217
'aliases' => array(),
@@ -328,7 +328,7 @@
328328
'nextcloud/3rdparty' => array(
329329
'pretty_version' => 'dev-master',
330330
'version' => 'dev-master',
331-
'reference' => '7290f9d6d76016c7a6c06f0e58a780101df3fc41',
331+
'reference' => '99ada0cd457b20fcadefef7a9c8f465a638dcb53',
332332
'type' => 'library',
333333
'install_path' => __DIR__ . '/../',
334334
'aliases' => array(),

guzzlehttp/psr7/src/LazyOpenStream.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* Lazily reads or writes to a file that is opened only after an IO operation
1111
* take place on the stream.
1212
*/
13-
#[\AllowDynamicProperties]
1413
final class LazyOpenStream implements StreamInterface
1514
{
1615
use StreamDecoratorTrait;
@@ -21,6 +20,11 @@ final class LazyOpenStream implements StreamInterface
2120
/** @var string */
2221
private $mode;
2322

23+
/**
24+
* @var StreamInterface
25+
*/
26+
private $stream;
27+
2428
/**
2529
* @param string $filename File to lazily open
2630
* @param string $mode fopen mode to use when opening the stream
@@ -29,6 +33,10 @@ public function __construct(string $filename, string $mode)
2933
{
3034
$this->filename = $filename;
3135
$this->mode = $mode;
36+
37+
// unsetting the property forces the first access to go through
38+
// __get().
39+
unset($this->stream);
3240
}
3341

3442
/**

guzzlehttp/psr7/src/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function bodySummary(MessageInterface $message, int $truncateAt =
7777

7878
// Matches any printable character, including unicode characters:
7979
// letters, marks, numbers, punctuation, spacing, and separators.
80-
if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/u', $summary)) {
80+
if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/u', $summary) !== 0) {
8181
return null;
8282
}
8383

0 commit comments

Comments
 (0)