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

[Hotfix] Validator\File classes behaviour with empty value #5555

Conversation

stefanotorresi
Copy link
Contributor

an empty $_FILES array would be passed to file validators under some circumstances, e.g. trying to upload a file that exceeds the php.ini upload_max_filesize value.

stream_resolve_include_path() is used in place of file_exists() across the whole Validator\File package and, while being faster, it actually returns the current working directory when called with an empty argument.

this PR prevents the subsequent inconsistent behaviour of all the validators using stream_resolve_include_path() when trying to validate an empty value. (triggering errors/warnings, displaying wrong failed validation message, etc)

Done/To-do

  • Crc32
  • ExcludeExtension
  • ExcludeMimeType
  • Extension
  • FileSize
  • Hash
  • ImageSize
  • Md5
  • MimeType
  • Size
  • UploadFile
  • WordCount

@weierophinney weierophinney added this to the 2.2.6 milestone Mar 3, 2014
@weierophinney weierophinney self-assigned this Mar 3, 2014
weierophinney added a commit that referenced this pull request Mar 3, 2014
…idator

[Hotfix] Validator\File classes behaviour with empty value
weierophinney added a commit that referenced this pull request Mar 3, 2014
@stefanotorresi stefanotorresi deleted the hotfix/file-mimetype-validator branch March 6, 2014 11:31
weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
…si/hotfix/file-mimetype-validator

[Hotfix] Validator\File classes behaviour with empty value
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.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants