Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

Use file_exists to check for an uploaded file.#6664

Merged
weierophinney merged 2 commits into
zendframework:masterfrom
akrabat:hotfix/uploadfile
Sep 16, 2014
Merged

Use file_exists to check for an uploaded file.#6664
weierophinney merged 2 commits into
zendframework:masterfrom
akrabat:hotfix/uploadfile

Conversation

@akrabat
Copy link
Copy Markdown
Contributor

@akrabat akrabat commented Sep 11, 2014

It turns out that stream_resolve_include_path doesn't work for a default
Windows install where upload_tmp_dir is set to C:\Windows\Temp. I'm
unclear if this is intended PHP behaviour or not, but the upload file
validator should not be checking for a file of the same name on the
include path regardless.

It turns out that stream_resolve_include_path doesn't work for a default
Windows install where upload_tmp_dir is set to C:\Windows\Temp. I'm
unclear if this is intended PHP behaviour or not, but the upload file
validator should not be checking for a file of the same name on the
include path regardless.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think is_file() is more specific, because file_exists() also returns true when it is a directory. It looks to me using file_exists() creates a way for hackers to "scan" the system for specific folders?

@akrabat
Copy link
Copy Markdown
Contributor Author

akrabat commented Sep 15, 2014

Good point @Martin-P. I've updated the PR.

weierophinney added a commit that referenced this pull request Sep 16, 2014
Use file_exists to check for an uploaded file.
weierophinney added a commit that referenced this pull request Sep 16, 2014
@weierophinney weierophinney added this to the 2.3.3 milestone Sep 16, 2014
@weierophinney weierophinney self-assigned this Sep 16, 2014
@weierophinney weierophinney merged commit e23eac0 into zendframework:master Sep 16, 2014
weierophinney added a commit that referenced this pull request Sep 16, 2014
@ThaDafinser
Copy link
Copy Markdown
Contributor

@akrabat seems to be still a bug on windows with default path.

Not in this validator, but in Zend\Validator\File\Size and many others:
https://github.com/zendframework/zf2/search?q=stream_resolve_include_path&type=Code&utf8=%E2%9C%93

weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
…ix/uploadfile

Use file_exists to check for an uploaded file.
weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants