-
-
Notifications
You must be signed in to change notification settings - Fork 88
Do not suppress 'permission denied' warnings in FileUpload::move() #82
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
This commit adds more comprehensible error reporting to the `move()` method in the following scenarios: * Say the program has insufficient permissions to create the directory `dirname($dest)`. With this commit the `move()` method correctly raises `mkdir(): Permission denied` warning instead of warning raised by `move_uploaded_file`: `failed to open stream: No such file or directory` with previous code. * Or the already existing file at `$dest` may not be deleted with the current permissions. With this commit a correct `Permission denied` warning is again raised by `unlink` instead of warning raised by `move_uploaded_file` with previous code.
|
You solution suffers with race condition problem. |
|
Then how about keeping the original code and adding |
|
Good point and good suggestion, thank you. The commit above should prevent the problem at least to the level the previous code prevented such problems. Is InvalidStateException the right one to be thrown? |
|
Are you sure, that only reason why directory has not been created is the permission problem? :) |
|
Right, inode limit comes to mind. I made the text more general with the commit above. |
|
See nette/tracy#133 |
|
What about call mkdir only when dir doesn't exist and remove @? |
|
That wouldn't be atomic though. |
|
This issue is about suppressing, isn't it? |
|
I replied to your previous comment:
|
|
I understand. |
This commit adds more comprehensible error reporting to the
move()method in the following scenarios:dirname($dest). With this commit themove()method correctly raisesmkdir(): Permission deniedwarning instead of warning raised bymove_uploaded_file:failed to open stream: No such file or directorywith previous code.$destmay not be deleted with the current permissions. With this commit a correctPermission deniedwarning is again raised byunlinkinstead of warning raised bymove_uploaded_filewith previous code.