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

[HttpFoundation] Check file exists before unlink#29764

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
nicolas-grekas merged 1 commit intosymfony:3.4fromad-mos:patch-1
Jan 25, 2019
Merged

[HttpFoundation] Check file exists before unlink#29764

nicolas-grekas merged 1 commit intosymfony:3.4fromad-mos:patch-1
Jan 25, 2019

Conversation

@ad-mos
Copy link
Contributor

@ad-mosad-mos commentedJan 3, 2019
edited
Loading

Check file exists to prevent ErrorException

QA
Branch?2.6
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#...
LicenseMIT
Doc PRsymfony/symfony-docs#...

fclose($file);

if ($this->deleteFileAfterSend) {
if ($this->deleteFileAfterSend &&file_exists($this->file->getPathname())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

doenstfopen already fail in this case?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The file can be deleted after fopen() while it is being sent to the user.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

got ya :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

But the file could also be removed between the calls tofile_exists() andunlink(). Maybe it would be better to silence the delete operation instead.

Copy link
ContributorAuthor

@ad-mosad-mosJan 4, 2019
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Downloading is a much longer process thanfile_exists()

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Also, I do not think that@unlink($this->file->getPathname()); would be a good solution here, it will ignore all errors, and not just 'No such file or directory'.
What else needs to be done for this to be merged ?

@chalasrchalasr added this to the3.4 milestoneJan 4, 2019
@nicolas-grekasnicolas-grekas changed the titleCheck file exists before unlink[HttpFoundation] Check file exists before unlinkJan 25, 2019
@nicolas-grekasnicolas-grekas changed the base branch frommaster to3.4January 25, 2019 11:01
@nicolas-grekas
Copy link
Member

Thank you @adam-mospan.

@nicolas-grekasnicolas-grekas merged commit1954187 intosymfony:3.4Jan 25, 2019
nicolas-grekas added a commit that referenced this pull requestJan 25, 2019
…pan)This PR was submitted for the master branch but it was squashed and merged into the 3.4 branch instead (closes#29764).Discussion----------[HttpFoundation] Check file exists before unlinkCheck file exists to prevent ErrorException| Q             | A| ------------- | ---| Branch?       | 2.6 <!-- see below -->| Bug fix?      | yes| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features --><!--Write a short README entry for your feature/bugfix here (replace this comment block.)This will help people understand your PR and can be used as a start of the Doc PR.Additionally: - Bug fixes must be submitted against the lowest branch where they apply   (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch.-->Commits-------1954187 [HttpFoundation] Check file exists before unlink
This was referencedJan 29, 2019
@ad-mosad-mos deleted the patch-1 branchFebruary 7, 2019 06:58
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh left review comments

+1 more reviewer

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

6 participants

@ad-mos@nicolas-grekas@ro0NL@xabbuh@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp