-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Filesystem Component] mkdir race condition fix #11626 #11726
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I made a pull request into master instead of 2.3 by error. For information, the bad PR is here #11697 |
Can somebody help me with travis failure ? What should I do ? |
throw new IOException(sprintf('Failed to create %s', $dir)); | ||
if (!is_dir($dir)) { | ||
// The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message | ||
$error = error_get_last(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move this line before the is_dir
check, just to be sure that you really get the error from mkdir
and not from is_dir
the condition should then be if ($error && !is_dir($dir))
@kcassam travis fails because you gave wrong number of arguments to the constructor. It only has 3 arguments, like the main PHP exception class. |
travis and other comments have been taken into account.
Thanks @jakzal @nicolas-grekas, i reworked my changes |
👍 |
Cool fix :) |
Question : Who will do the adaptation for version >= 2.4 because IOException constructor call are not the same :
Should I do another pull request ? |
I agree with @1emming #11726 (comment) I suggest Simpler :
Or More developer friendly :
Which is better ? |
better error management following feedback
I commited the developer friendly version |
throw new IOException(sprintf('Failed to create %s', $dir)); | ||
$error = error_get_last(); | ||
if (!is_dir($dir)) { | ||
// The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a very minor issue: one space is missing at the beginning of this line.
👍 |
Thank you @kcassam. |
…assam) This PR was squashed before being merged into the 2.3 branch (closes #11726). Discussion ---------- [Filesystem Component] mkdir race condition fix #11626 [Filesystem Component] Fix mkdir race condition | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #11626 | License | MIT | Doc PR | none Commits ------- 0483452 [Filesystem Component] mkdir race condition fix #11626
Happy to have contributed. One newbie question though : How this correction will go through version of Symfony >=2.4 to master ? Do I have to redo it for each version ? |
@kcassam Thanks for your help. You don't need to do anything; old branches are merged into newer ones on a regular basis. So, your changes will appear in other branches in the next days. |
[Filesystem Component] Fix mkdir race condition