From b874ab07b3b3701ec60ee051ecab21fb84225ad8 Mon Sep 17 00:00:00 2001 From: Mikk Tendermann Date: Thu, 13 Apr 2017 13:11:47 +0300 Subject: [PATCH 1/3] disable ipv6 checks --- framework/validators/IpValidator.php | 6 +----- tests/framework/validators/IpValidatorTest.php | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/framework/validators/IpValidator.php b/framework/validators/IpValidator.php index 9b09ccee0b4..bdcf32c3a19 100644 --- a/framework/validators/IpValidator.php +++ b/framework/validators/IpValidator.php @@ -221,11 +221,7 @@ public function init() if (!$this->ipv4 && !$this->ipv6) { throw new InvalidConfigException('Both IPv4 and IPv6 checks can not be disabled at the same time'); } - - if (!defined('AF_INET6') && $this->ipv6) { - throw new InvalidConfigException('IPv6 validation can not be used. PHP is compiled without IPv6'); - } - + if ($this->message === null) { $this->message = Yii::t('yii', '{attribute} must be a valid IP address.'); } diff --git a/tests/framework/validators/IpValidatorTest.php b/tests/framework/validators/IpValidatorTest.php index 04cd90e7ede..1bee4435e50 100644 --- a/tests/framework/validators/IpValidatorTest.php +++ b/tests/framework/validators/IpValidatorTest.php @@ -13,10 +13,6 @@ class IpValidatorTest extends TestCase { protected function setUp() { - if (!defined('AF_INET6')) { - $this->markTestSkipped('The environment does not support IPv6.'); - } - parent::setUp(); $this->mockApplication(); } From 7366864aa2920f408b312680dcff27685e772ead Mon Sep 17 00:00:00 2001 From: Mikk Tendermann Date: Thu, 13 Apr 2017 14:07:30 +0300 Subject: [PATCH 2/3] remove empty line --- framework/validators/IpValidator.php | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/validators/IpValidator.php b/framework/validators/IpValidator.php index bdcf32c3a19..bfe84f79bd1 100644 --- a/framework/validators/IpValidator.php +++ b/framework/validators/IpValidator.php @@ -221,7 +221,6 @@ public function init() if (!$this->ipv4 && !$this->ipv6) { throw new InvalidConfigException('Both IPv4 and IPv6 checks can not be disabled at the same time'); } - if ($this->message === null) { $this->message = Yii::t('yii', '{attribute} must be a valid IP address.'); } From 22a4209b7fc956322b28aabceb538af63044d729 Mon Sep 17 00:00:00 2001 From: Mikk Tendermann Date: Fri, 14 Apr 2017 18:49:03 +0300 Subject: [PATCH 3/3] updated CHANGELOG.md --- framework/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 5bb436e2d68..0cfce1c906e 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -64,6 +64,7 @@ Yii Framework 2 Change Log - Bug #13901: Fixed passing unused parameter to `formatMessage()` call in `\yii\validators\IpValidator` (Kolyunya) - Enh #13945: Removed Courier New from error page fonts list since it looks bad on Linux (samdark) - Bug #13961: RBAC Rules: PostgreSQL: PHP Warning "unserialize() expects parameter 1 to be string, resource given" was fixed (vsguts) +- Enh #13976: Disabled IPv6 check on `\yii\validators\IpValidator` as it turns out it is not needed for inet_* methods to work (mikk150) 2.0.11.2 February 08, 2017 --------------------------