From 9d26add4d02faa225f5a328bd77df7f9503aec9b Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Fri, 23 Jun 2017 11:46:00 +0200 Subject: [PATCH 1/7] Adapt .travis.yml to recent ZF standards --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 44b0eb45e..7b6c5acc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ branches: cache: directories: - - $HOME/.composer/cache + - $HOME/.composer/ - $HOME/.local - zf-mkdoc-theme @@ -91,7 +91,7 @@ install: - travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs - if [[ $TRAVIS_PHP_VERSION =~ ^5.6 ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi - if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi - - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi + - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update $COMPOSER_ARGS --prefer-lowest --prefer-stable ; fi - if [[ $SERVICE_MANAGER_VERSION != '' ]]; then travis_retry composer require --dev --no-update $COMPOSER_ARGS "zendframework/zend-servicemanager:$SERVICE_MANAGER_VERSION" ; fi - if [[ $SERVICE_MANAGER_VERSION == '' ]]; then travis_retry composer require --dev --no-update $COMPOSER_ARGS "zendframework/zend-servicemanager:^3.0.3" ; fi - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi @@ -104,12 +104,12 @@ script: - if [[ $EXECUTE_HOSTNAME_CHECK == "true" && $TRAVIS_PULL_REQUEST == "false" ]]; then php bin/update_hostname_validator.php --check-only; fi - if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi -after_script: - - if [[ $TEST_COVERAGE == 'true' ]]; then composer upload-coverage ; fi - after_success: - if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi +after_script: + - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer upload-coverage ; fi + notifications: email: false slack: From 92035a47e70a0dc726698e0eac902653b8587256 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Fri, 23 Jun 2017 11:46:47 +0200 Subject: [PATCH 2/7] Travis: drop HVVM & add PHP 7.2 --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7b6c5acc3..44944de12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,21 +67,21 @@ 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 - - php: hhvm + - php: nightly env: - DEPS=locked - SERVICE_MANAGER_VERSION="^2.7.5" allow_failures: - - php: hhvm + - php: nightly before_install: - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi From 1a0717cd4f2e74ff947c3e068181718a186b37f2 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Fri, 23 Jun 2017 11:57:39 +0200 Subject: [PATCH 3/7] Prepare to PHP 7.2 --- bin/update_hostname_validator.php | 4 +++- src/EmailAddress.php | 4 ++-- src/File/Upload.php | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/update_hostname_validator.php b/bin/update_hostname_validator.php index fab52c24e..49070cbb5 100644 --- a/bin/update_hostname_validator.php +++ b/bin/update_hostname_validator.php @@ -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(); diff --git a/src/EmailAddress.php b/src/EmailAddress.php index d089f84c0..55c450eef 100644 --- a/src/EmailAddress.php +++ b/src/EmailAddress.php @@ -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; } @@ -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; } diff --git a/src/File/Upload.php b/src/File/Upload.php index 55025f633..724a8987d 100644 --- a/src/File/Upload.php +++ b/src/File/Upload.php @@ -9,6 +9,7 @@ namespace Zend\Validator\File; +use Countable; use Zend\Validator\AbstractValidator; use Zend\Validator\Exception; @@ -109,7 +110,7 @@ public function getFiles($file = null) */ public function setFiles($files = []) { - if (count($files) === 0) { + if ((is_array($files) || $files instanceof Countable) && count($files) === 0) { $this->options['files'] = $_FILES; } else { $this->options['files'] = $files; From 407ee843496ebed629e3816f01d1c4f53f9ae230 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Fri, 23 Jun 2017 16:49:15 +0200 Subject: [PATCH 4/7] In PHP < 7.2 `0 === count(null)` --- src/File/Upload.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/File/Upload.php b/src/File/Upload.php index 724a8987d..a721dfe3e 100644 --- a/src/File/Upload.php +++ b/src/File/Upload.php @@ -110,7 +110,7 @@ public function getFiles($file = null) */ public function setFiles($files = []) { - if ((is_array($files) || $files instanceof Countable) && count($files) === 0) { + if (null === $files || ((is_array($files) || $files instanceof Countable) && count($files) === 0)) { $this->options['files'] = $_FILES; } else { $this->options['files'] = $files; From d0316a1e0d60ef2c33a551b3cd06be1228580dfc Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 25 Jul 2017 09:07:28 -0500 Subject: [PATCH 5/7] Provides CS fix for update_hostname_validator - Whitespace following `function` keyword --- bin/update_hostname_validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/update_hostname_validator.php b/bin/update_hostname_validator.php index 49070cbb5..69043d681 100644 --- a/bin/update_hostname_validator.php +++ b/bin/update_hostname_validator.php @@ -177,7 +177,7 @@ function getNewValidTlds($string) function getPunycodeDecoder() { if (function_exists('idn_to_utf8')) { - return function($domain) { + return function ($domain) { return idn_to_utf8($domain, 0, INTL_IDNA_VARIANT_UTS46); }; } From 612035786724cd3c4b0d9b166914ac3321dbd688 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 25 Jul 2017 09:09:03 -0500 Subject: [PATCH 6/7] Provides formatting of complex conditional - Uses newlines and indentation to group conditional statements --- src/File/Upload.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/File/Upload.php b/src/File/Upload.php index a721dfe3e..33b664b3a 100644 --- a/src/File/Upload.php +++ b/src/File/Upload.php @@ -110,7 +110,10 @@ public function getFiles($file = null) */ public function setFiles($files = []) { - if (null === $files || ((is_array($files) || $files instanceof Countable) && count($files) === 0)) { + if (null === $files + || ((is_array($files) || $files instanceof Countable) + && count($files) === 0) + ) { $this->options['files'] = $_FILES; } else { $this->options['files'] = $files; From af974c96a2ceca74ce529400702b77dee6e02d90 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 25 Jul 2017 09:10:30 -0500 Subject: [PATCH 7/7] Adds CHANGELOG for #175 --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 597c7fbb6..eaa64bf1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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