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

Commit 809093c

Browse files
committed
Merge pull request #175 from Slamdunk/php_72
Add PHP 7.2 support, drop HHVM Conflicts: .travis.yml
2 parents 8d4989d + 407ee84 commit 809093c

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ branches:
99

1010
cache:
1111
directories:
12-
- $HOME/.composer/cache
12+
- $HOME/.composer/
1313

1414
env:
1515
global:
@@ -50,17 +50,17 @@ matrix:
5050
- php: 7.1
5151
env:
5252
- DEPS=latest
53-
- php: hhvm
53+
- php: nightly
5454
env:
5555
- DEPS=lowest
56-
- php: hhvm
56+
- php: nightly
5757
env:
5858
- DEPS=locked
59-
- php: hhvm
59+
- php: nightly
6060
env:
6161
- DEPS=latest
6262
allow_failures:
63-
- php: hhvm
63+
- php: nightly
6464

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

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

8686
notifications:
8787
email: false

bin/update_hostname_validator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ function getNewValidTlds($string)
177177
function getPunycodeDecoder()
178178
{
179179
if (function_exists('idn_to_utf8')) {
180-
return 'idn_to_utf8';
180+
return function($domain) {
181+
return idn_to_utf8($domain, 0, INTL_IDNA_VARIANT_UTS46);
182+
};
181183
}
182184

183185
$hostnameValidator = new Hostname();

src/EmailAddress.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ public function isValid($value)
530530
protected function idnToAscii($email)
531531
{
532532
if (extension_loaded('intl')) {
533-
return (idn_to_ascii($email) ?: $email);
533+
return (idn_to_ascii($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email);
534534
}
535535
return $email;
536536
}
@@ -553,7 +553,7 @@ protected function idnToUtf8($email)
553553
// the source string in those cases.
554554
// But not when the source string is long enough.
555555
// Thus we default to source string ourselves.
556-
return idn_to_utf8($email) ?: $email;
556+
return idn_to_utf8($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email;
557557
}
558558
return $email;
559559
}

src/File/Upload.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace Zend\Validator\File;
1111

12+
use Countable;
1213
use Zend\Validator\AbstractValidator;
1314
use Zend\Validator\Exception;
1415

@@ -109,7 +110,7 @@ public function getFiles($file = null)
109110
*/
110111
public function setFiles($files = [])
111112
{
112-
if (count($files) === 0) {
113+
if (null === $files || ((is_array($files) || $files instanceof Countable) && count($files) === 0)) {
113114
$this->options['files'] = $_FILES;
114115
} else {
115116
$this->options['files'] = $files;

0 commit comments

Comments
 (0)