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

Commit

Permalink
Merge pull request #175 from Slamdunk/php_72
Browse files Browse the repository at this point in the history
Add PHP 7.2 support, drop HHVM

Conflicts:
	.travis.yml
  • Loading branch information
weierophinney committed Jul 25, 2017
2 parents 8d4989d + 407ee84 commit 809093c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 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
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
3 changes: 2 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,7 @@ 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 809093c

Please sign in to comment.