From 378ddb69b18bf7e45d1420bc9bc2837f684a8e5e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 29 Apr 2024 10:23:08 +0200 Subject: [PATCH 1/5] better distinguish URL schemes and windows drive letters --- Path.php | 2 +- Tests/PathTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Path.php b/Path.php index 858e1623e..eb6d8ea08 100644 --- a/Path.php +++ b/Path.php @@ -368,7 +368,7 @@ public static function isAbsolute(string $path): bool } // Strip scheme - if (false !== $schemeSeparatorPosition = strpos($path, '://')) { + if (false !== ($schemeSeparatorPosition = strpos($path, '://')) && 1 !== $schemeSeparatorPosition) { $path = substr($path, $schemeSeparatorPosition + 3); } diff --git a/Tests/PathTest.php b/Tests/PathTest.php index 77b9f2a2d..17c6142c3 100644 --- a/Tests/PathTest.php +++ b/Tests/PathTest.php @@ -375,6 +375,8 @@ public static function provideIsAbsolutePathTests(): \Generator yield ['C:/css/style.css', true]; yield ['D:/', true]; + yield ['C:///windows', true]; + yield ['C://test', true]; yield ['E:\\css\\style.css', true]; yield ['F:\\', true]; From 4eb063a894c8caa4aebf1d2fac6e4dc7a754069f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 30 Apr 2024 11:14:43 +0200 Subject: [PATCH 2/5] move Process component dep to require-dev --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 95e9f3f03..5811ef590 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,9 @@ "php": ">=7.2.5", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8", - "symfony/polyfill-php80": "^1.16", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { "symfony/process": "^5.4|^6.4" }, "autoload": { From a7f188b5317c2160e27c4415c688f4c95951f8bb Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Thu, 2 May 2024 10:47:54 +0200 Subject: [PATCH 3/5] [Filesystem] Run high-deps tests with Process 7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6a8671b8d..fd75755b2 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "symfony/process": "^5.4|^6.4" + "symfony/process": "^5.4|^6.4|^7.0" }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" }, From f538cda53f049d9eb6ef4f75088b9210a9f70958 Mon Sep 17 00:00:00 2001 From: acoulton Date: Fri, 10 May 2024 09:52:29 +0100 Subject: [PATCH 4/5] [Filesystem] Fix dumpFile `stat failed` error hitting custom handler Since #54471, dumpFile will trigger a `fileperms(): stat failed` error when writing to a filename that does not yet exist. This was silenced from PHP's default handler with the `@` operator. However, the error is still passed to any custom handler that the application has registered, and can therefore cause exceptions or spurious logging depending on the implementation of the handler. The better solution, which is consistent with all other calls to native functions in this class, would be to use `self::box` to catch and ignore the potential error so that it never leaks outside this class. --- Filesystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Filesystem.php b/Filesystem.php index c5cfa4714..700311d58 100644 --- a/Filesystem.php +++ b/Filesystem.php @@ -691,7 +691,7 @@ public function dumpFile(string $filename, $content) throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename); } - self::box('chmod', $tmpFile, @fileperms($filename) ?: 0666 & ~umask()); + self::box('chmod', $tmpFile, self::box('fileperms', $filename) ?: 0666 & ~umask()); $this->rename($tmpFile, $filename, true); } finally { From 26dd9912df6940810ea00f8f53ad48d6a3424995 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 31 May 2024 16:33:22 +0200 Subject: [PATCH 5/5] Revert "minor #54653 Auto-close PRs on subtree-splits (nicolas-grekas)" This reverts commit 2c9352dd91ebaf37b8a3e3c26fd8e1306df2fb73, reversing changes made to 18c3e87f1512be2cc50e90235b144b13bc347258. --- .gitattributes | 3 +- .github/PULL_REQUEST_TEMPLATE.md | 8 ----- .github/workflows/check-subtree-split.yml | 37 ----------------------- 3 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/check-subtree-split.yml diff --git a/.gitattributes b/.gitattributes index 14c3c3594..84c7add05 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ /Tests export-ignore /phpunit.xml.dist export-ignore -/.git* export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 4689c4dad..000000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,8 +0,0 @@ -Please do not submit any Pull Requests here. They will be closed. ---- - -Please submit your PR here instead: -https://github.com/symfony/symfony - -This repository is what we call a "subtree split": a read-only subset of that main repository. -We're looking forward to your PR there! diff --git a/.github/workflows/check-subtree-split.yml b/.github/workflows/check-subtree-split.yml deleted file mode 100644 index 16be48bae..000000000 --- a/.github/workflows/check-subtree-split.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Check subtree split - -on: - pull_request_target: - -jobs: - close-pull-request: - runs-on: ubuntu-latest - - steps: - - name: Close pull request - uses: actions/github-script@v6 - with: - script: | - if (context.repo.owner === "symfony") { - github.rest.issues.createComment({ - owner: "symfony", - repo: context.repo.repo, - issue_number: context.issue.number, - body: ` - Thanks for your Pull Request! We love contributions. - - However, you should instead open your PR on the main repository: - https://github.com/symfony/symfony - - This repository is what we call a "subtree split": a read-only subset of that main repository. - We're looking forward to your PR there! - ` - }); - - github.rest.pulls.update({ - owner: "symfony", - repo: context.repo.repo, - pull_number: context.issue.number, - state: "closed" - }); - }