Skip to content

Commit

Permalink
Merge pull request #1388 from nextcloud/bump/guzzle-psr7/master
Browse files Browse the repository at this point in the history
[master] sec(deps): Update guzzlehttp/psr7
  • Loading branch information
nickvergessen authored Apr 26, 2023
2 parents e31af93 + 51530d8 commit 6f18457
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 42 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization

name: Lint php

on:
pull_request:
push:
branches:
- main
- master
- stable*

permissions:
contents: read

concurrency:
group: lint-php-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
php-lint:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ "8.0", "8.1", "8.2" ]

name: php-lint

steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint
run: composer run lint

summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: php-lint

if: always()

name: php-lint-summary

steps:
- name: Summary status
run: if ${{ needs.php-lint.result != 'success' && needs.php-lint.result != 'skipped' }}; then exit 1; fi
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
"symfony/translation": "^4.4.41",
"web-auth/webauthn-lib": "^3.1"
},
"scripts": {
"lint": "find . -name \\*.php -print0 | xargs -0 -n1 php -l"
},
"extra": {
"patches-file": "composer.patches.json"
}
Expand Down
17 changes: 7 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 7 additions & 10 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1563,17 +1563,17 @@
},
{
"name": "guzzlehttp/psr7",
"version": "2.4.3",
"version_normalized": "2.4.3.0",
"version": "2.4.5",
"version_normalized": "2.4.5.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "67c26b443f348a51926030c83481b85718457d3d"
"reference": "0454e12ef0cd597ccd2adb036f7bda4e7fface66"
},
"dist": {
"type": "zip",
"url": "https://github.com/gitapi/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d",
"reference": "67c26b443f348a51926030c83481b85718457d3d",
"url": "https://github.com/gitapi/repos/guzzle/psr7/zipball/0454e12ef0cd597ccd2adb036f7bda4e7fface66",
"reference": "0454e12ef0cd597ccd2adb036f7bda4e7fface66",
"shasum": ""
},
"require": {
Expand All @@ -1594,15 +1594,12 @@
"suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
},
"time": "2022-10-26T14:07:24+00:00",
"time": "2023-04-17T16:00:45+00:00",
"type": "library",
"extra": {
"bamarni-bin": {
"bin-links": true,
"forward-command": false
},
"branch-alias": {
"dev-master": "2.4-dev"
}
},
"installation-source": "dist",
Expand Down Expand Up @@ -1665,7 +1662,7 @@
],
"support": {
"issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.4.3"
"source": "https://github.com/guzzle/psr7/tree/2.4.5"
},
"funding": [
{
Expand Down
18 changes: 9 additions & 9 deletions composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'nextcloud/3rdparty',
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => NULL,
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '6c36449d6cea0a8b5eec3a3c7d1b40a137b689b7',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down Expand Up @@ -209,9 +209,9 @@
'dev_requirement' => false,
),
'guzzlehttp/psr7' => array(
'pretty_version' => '2.4.3',
'version' => '2.4.3.0',
'reference' => '67c26b443f348a51926030c83481b85718457d3d',
'pretty_version' => '2.4.5',
'version' => '2.4.5.0',
'reference' => '0454e12ef0cd597ccd2adb036f7bda4e7fface66',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
Expand Down Expand Up @@ -326,9 +326,9 @@
'dev_requirement' => false,
),
'nextcloud/3rdparty' => array(
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => NULL,
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '6c36449d6cea0a8b5eec3a3c7d1b40a137b689b7',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down
10 changes: 9 additions & 1 deletion guzzlehttp/psr7/src/LazyOpenStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* Lazily reads or writes to a file that is opened only after an IO operation
* take place on the stream.
*/
#[\AllowDynamicProperties]
final class LazyOpenStream implements StreamInterface
{
use StreamDecoratorTrait;
Expand All @@ -21,6 +20,11 @@ final class LazyOpenStream implements StreamInterface
/** @var string */
private $mode;

/**
* @var StreamInterface
*/
private $stream;

/**
* @param string $filename File to lazily open
* @param string $mode fopen mode to use when opening the stream
Expand All @@ -29,6 +33,10 @@ public function __construct(string $filename, string $mode)
{
$this->filename = $filename;
$this->mode = $mode;

// unsetting the property forces the first access to go through
// __get().
unset($this->stream);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion guzzlehttp/psr7/src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static function bodySummary(MessageInterface $message, int $truncateAt =

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

Expand Down
13 changes: 6 additions & 7 deletions guzzlehttp/psr7/src/MessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,9 @@ private function assertHeader($header): void
));
}

if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) {
if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) {
throw new \InvalidArgumentException(
sprintf(
'"%s" is not valid header name',
$header
)
sprintf('"%s" is not valid header name.', $header)
);
}
}
Expand Down Expand Up @@ -257,8 +254,10 @@ private function assertValue(string $value): void
// Clients must not send a request with line folding and a server sending folded headers is
// likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting
// folding is not likely to break any legitimate use case.
if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) {
throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value));
if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/D', $value)) {
throw new \InvalidArgumentException(
sprintf('"%s" is not valid header value.', $value)
);
}
}
}
8 changes: 4 additions & 4 deletions guzzlehttp/psr7/src/ServerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ private static function normalizeNestedFileSpec(array $files = []): array
foreach (array_keys($files['tmp_name']) as $key) {
$spec = [
'tmp_name' => $files['tmp_name'][$key],
'size' => $files['size'][$key],
'error' => $files['error'][$key],
'name' => $files['name'][$key],
'type' => $files['type'][$key],
'size' => $files['size'][$key] ?? null,
'error' => $files['error'][$key] ?? null,
'name' => $files['name'][$key] ?? null,
'type' => $files['type'][$key] ?? null,
];
$normalizedFiles[$key] = self::createUploadedFileFromSpec($spec);
}
Expand Down

0 comments on commit 6f18457

Please sign in to comment.