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

Commit

Permalink
Merge branch 'feature/175' into develop
Browse files Browse the repository at this point in the history
Close #175
  • Loading branch information
weierophinney committed Jul 25, 2017
2 parents 8d4989d + af974c9 commit 93601c7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ branches:

cache:
directories:
- $HOME/.composer/cache
- $HOME/.composer/

env:
global:
Expand Down Expand Up @@ -50,17 +50,17 @@ matrix:
- php: 7.1
env:
- DEPS=latest
- php: hhvm
- php: nightly
env:
- DEPS=lowest
- php: hhvm
- php: nightly
env:
- DEPS=locked
- php: hhvm
- php: nightly
env:
- DEPS=latest
allow_failures:
- php: hhvm
- php: nightly

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
Expand All @@ -81,7 +81,7 @@ script:
- if [[ $EXECUTE_HOSTNAME_CHECK == "true" && $TRAVIS_PULL_REQUEST == "false" ]]; then php bin/update_hostname_validator.php --check-only; fi

after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer upload-coverage ; fi

notifications:
email: false
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ All notable changes to this project will be documented in this file, in reverse

### Added

- Nothing.
- [#175](https://github.com/zendframework/zend-validator/pull/175) adds support
for PHP 7.2 (conditionally, as PHP 7.2 is currently in beta1).

### Changed

Expand All @@ -22,7 +23,8 @@ All notable changes to this project will be documented in this file, in reverse

### Removed

- Nothing.
- [#175](https://github.com/zendframework/zend-validator/pull/175) removes
support for HHVM.

### Fixed

Expand Down
4 changes: 3 additions & 1 deletion bin/update_hostname_validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ function getNewValidTlds($string)
function getPunycodeDecoder()
{
if (function_exists('idn_to_utf8')) {
return 'idn_to_utf8';
return function ($domain) {
return idn_to_utf8($domain, 0, INTL_IDNA_VARIANT_UTS46);
};
}

$hostnameValidator = new Hostname();
Expand Down
4 changes: 2 additions & 2 deletions src/EmailAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public function isValid($value)
protected function idnToAscii($email)
{
if (extension_loaded('intl')) {
return (idn_to_ascii($email) ?: $email);
return (idn_to_ascii($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email);
}
return $email;
}
Expand All @@ -553,7 +553,7 @@ protected function idnToUtf8($email)
// the source string in those cases.
// But not when the source string is long enough.
// Thus we default to source string ourselves.
return idn_to_utf8($email) ?: $email;
return idn_to_utf8($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email;
}
return $email;
}
Expand Down
6 changes: 5 additions & 1 deletion src/File/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Zend\Validator\File;

use Countable;
use Zend\Validator\AbstractValidator;
use Zend\Validator\Exception;

Expand Down Expand Up @@ -109,7 +110,10 @@ public function getFiles($file = null)
*/
public function setFiles($files = [])
{
if (count($files) === 0) {
if (null === $files
|| ((is_array($files) || $files instanceof Countable)
&& count($files) === 0)
) {
$this->options['files'] = $_FILES;
} else {
$this->options['files'] = $files;
Expand Down

0 comments on commit 93601c7

Please sign in to comment.