Find file History
weierophinney Refactor PSR-7 support
- Removes zend-diactoros from requirements.

- Updates tests to use mock `UploadedFileInterface` instances, instead
  of using zend-diactoros; this keeps the support agnostic.

- Modifies `UploadFile` to store the `UploadedFileInterface` instance
  instead of the stream URI; this is more consistent with the
  implementation of `Upload`, which stores an array of
  `UploadedFileInterface` instances.

- The detection of an attack is moot with PSR-7, as it stores the
  uploaded file as an in-memory stream. As such, I modified both classes
  to omit that check; if we get an `UPLOAD_ERR_OK`, we have a valid
  upload at that point.

- I extracted three methods from `UploadFile::isValid()`:
  - `validateFileFromErrorCode()` does a switch around the error code,
    setting errors and returning a boolean.
  - `validateUploadedFile()` is used in both the string and array value
    cases of `isValid()` to validate the incoming file. If
    `UPLOAD_ERR_OK` is detected, it performs additional logic to detect
    an upload attack, but otherwise delegates to
    `validateFileFromErrorCode()`.
  - `validatePsr7UploadedFile()` is used when the value is an
    `UploadedFileInterface`, and delegates to
    `validateFileFromErrorCode()`, using the result of `getError()`.

- I refactored the new unit tests to use data providers whenever
  possible.
Latest commit 935e772 Dec 13, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Barcode Revert "Merge pull request #105 from FraGoTe/patch-1" May 17, 2017
Db Automated CS fixes Mar 10, 2017
Exception Happy new year 2015 Jan 1, 2015
File Refactor PSR-7 support Dec 13, 2018
Hostname CS fixes Mar 10, 2017
Isbn CS fixes Feb 17, 2016
Sitemap CS fixes Mar 10, 2017
Translator Happy new year 2015 Jan 1, 2015
AbstractValidator.php Automated CS fixes Mar 10, 2017
Barcode.php Automated CS fixes Mar 10, 2017
Between.php Provides fix for #125 Jul 31, 2017
Bitwise.php Automated CS fixes Mar 10, 2017
Callback.php Automated CS fixes Mar 10, 2017
ConfigProvider.php Moves aliases before factories Aug 14, 2017
CreditCard.php change substr with strpos when possible May 8, 2018
Csrf.php CS fixes per phpcs Feb 1, 2018
Date.php Automated CS fixes Mar 10, 2017
DateStep.php Automated CS fixes Mar 10, 2017
Digits.php Automated CS fixes Mar 10, 2017
EmailAddress.php Fixes #193 : use INTL_IDNA_VARIANT_UTS46 constant only when exists Aug 19, 2017
Explode.php count optimization Jul 9, 2018
GpsPoint.php Automated CS fixes Mar 10, 2017
GreaterThan.php Automated CS fixes Mar 10, 2017
Hex.php Automated CS fixes Mar 10, 2017
Hostname.php Merge pull request #241 from andreasschroth/andreasschroth_fix_issue_240 Dec 13, 2018
Iban.php issue-201 - add tow countries for SEPA validation (croatia and san ma… Oct 17, 2017
Identical.php Automated CS fixes Mar 10, 2017
InArray.php CS fixes Mar 10, 2017
Ip.php CS fixes Mar 10, 2017
IsCountable.php Updates IsCountable to not allow passing both a count and a min or ma… Jul 26, 2017
IsInstanceOf.php Automated CS fixes Mar 10, 2017
Isbn.php CS fixes Mar 10, 2017
LessThan.php Automated CS fixes Mar 10, 2017
Module.php Merge pull request #64 from golovanov/validator-provider May 16, 2016
NotEmpty.php Fix CS Mar 17, 2017
Regex.php Fixed Regex constructor parameter type docblock Aug 25, 2017
StaticValidator.php Ensure backwards compatibility with v2 Feb 17, 2016
Step.php Adds missing docblock for Step::getPrecision Dec 13, 2018
StringLength.php count optimization Jul 9, 2018
Timezone.php Automated CS fixes Mar 10, 2017
Uri.php Automated CS fixes Mar 10, 2017
Uuid.php Minor CS/test changes May 16, 2016
ValidatorChain.php CS fixes Mar 10, 2017
ValidatorInterface.php Happy new year 2015 Jan 1, 2015
ValidatorPluginManager.php register GpsPoint validator into ValidatorPluginManager Aug 22, 2017
ValidatorPluginManagerAwareInterface.php Happy new year 2015 Jan 1, 2015
ValidatorPluginManagerFactory.php Ensure `validators` config is honored in non-zend-mvc contexts May 16, 2017
ValidatorProviderInterface.php Added class-level docblock to new interface May 16, 2016