Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Filesystem] Fix dumpFilestat failed error hitting custom handler#54878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@acoulton
Copy link
Contributor

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesSee below
LicenseMIT

Since#54471, dumpFile will trigger afileperms(): 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 useself::box to catch and ignore the potential error so that it never leaks outside this class.

ebuildy and oojacoboo reacted with thumbs up emoji
Sincesymfony#54471, dumpFile will trigger a `fileperms(): stat failed`error when writing to a filename that does not yet exist. Thiswas silenced from PHP's default handler with the `@` operator.However, the error is still passed to any custom handler that theapplication has registered, and can therefore cause exceptions orspurious logging depending on the implementation of the handler.The better solution, which is consistent with all other calls tonative functions in this class, would be to use `self::box` tocatch and ignore the potential error so that it never leaksoutside this class.
@acoulton
Copy link
ContributorAuthor

As far as I can see the coding standards and test failures are unrelated to the change in this branch - but please let me know if you want any changes.

@xabbuh
Copy link
Member

The proposed solution works for me but:

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.

This is still an error in the custom error handler if it doesn't respect the silencing of errors and should be fixed nonetheless as an error handler throwing no matter if the error was silenced can still throw too eagerly.

@xabbuhxabbuh added this to the5.4 milestoneMay 10, 2024
@acoulton
Copy link
ContributorAuthor

This is still an error in the custom error handler if it doesn't respect the silencing of errors and should be fixed nonetheless as an error handler throwing no matter if the error was silenced can still throw too eagerly.

That's probably true. At the same time, I don't think a library should be relying on the silencing operator to suppress errors that are emitted during expected usage of a method - in particular if it hasn't done so in the past, since this might break existing applications where the over-eager throw has not historically caused any problems.

@carsonbotcarsonbot changed the title[Filesystem] Fix dumpFilestat failed error hitting custom handlerFix dumpFilestat failed error hitting custom handlerMay 13, 2024
@carsonbotcarsonbot changed the titleFix dumpFilestat failed error hitting custom handler[Filesystem] Fix dumpFilestat failed error hitting custom handlerMay 15, 2024
@nicolas-grekas
Copy link
Member

Thank you@acoulton.

acoulton reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas merged commitf68a8df intosymfony:5.4May 16, 2024
@acoultonacoulton deleted the fs-fileperms-error-handler branchMay 16, 2024 17:32
@fabpotfabpot mentioned this pull requestMay 17, 2024
This was referencedJun 2, 2024
github-merge-queuebot pushed a commit to Lendable/composer-license-checker that referenced this pull requestJun 3, 2024
[![MendRenovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)This PR contains the following updates:| Package | Change | Age | Adoption | Passing | Confidence ||---|---|---|---|---|---|| [symfony/filesystem](https://symfony.com)([source](https://togithub.com/symfony/filesystem)) | `6.4.6` -> `6.4.8`|[![age](https://developer.mend.io/api/mc/badges/age/packagist/symfony%2ffilesystem/6.4.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)|[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/symfony%2ffilesystem/6.4.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)|[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/symfony%2ffilesystem/6.4.6/6.4.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)|[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/symfony%2ffilesystem/6.4.6/6.4.8?slim=true)](https://docs.renovatebot.com/merge-confidence/)|---### Release Notes<details><summary>symfony/filesystem (symfony/filesystem)</summary>###[`v6.4.8`](https://togithub.com/symfony/filesystem/releases/tag/v6.4.8)[CompareSource](https://togithub.com/symfony/filesystem/compare/v6.4.7...v6.4.8)**Changelog**(symfony/filesystem@v6.4.7...v6.4.8)- bug[symfony/symfony#54878](https://togithub.com/symfony/symfony/issues/54878)\[Filesystem] Fix dumpFile `stat failed` error hitting custom handler(@&#8203;acoulton)- bug[symfony/symfony#54759](https://togithub.com/symfony/symfony/issues/54759)\[Filesystem] better distinguish URL schemes and Windows drive letters([@&#8203;xabbuh](https://togithub.com/xabbuh))###[`v6.4.7`](https://togithub.com/symfony/filesystem/releases/tag/v6.4.7)[CompareSource](https://togithub.com/symfony/filesystem/compare/v6.4.6...v6.4.7)**Changelog**(symfony/filesystem@v6.4.6...v6.4.7)- bug[symfony/symfony#54471](https://togithub.com/symfony/symfony/issues/54471)\[Filesystem] Strengthen the check of file permissions in `dumpFile`(@&#8203;alexandre-daubois)</details>---### Configuration📅 **Schedule**: Branch creation - At any time (no schedule defined),Automerge - At any time (no schedule defined).🚦 **Automerge**: Enabled.♻ **Rebasing**: Whenever PR becomes conflicted, or you tick therebase/retry checkbox.🔕 **Ignore**: Close this PR and you won't be reminded about this updateagain.---- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, checkthis box---This PR has been generated by [MendRenovate](https://www.mend.io/free-developer-tools/renovate/). Viewrepository job log[here](https://developer.mend.io/github/Lendable/composer-license-checker).<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM3Ny44IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

4 participants

@acoulton@xabbuh@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp