mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Fixes #14033: Fixed yii\filters\AccessRule::matchIp() erroring in case IP is not defined under HHVM
This commit is contained in:
committed by
Alexander Makarov
parent
d786b78f25
commit
1e65fc29ed
@ -4,6 +4,7 @@ Yii Framework 2 Change Log
|
||||
2.0.12 under development
|
||||
--------------------------
|
||||
|
||||
- Bug #14033: Fixed `yii\filters\AccessRule::matchIp()` erroring in case IP is not defined under HHVM (Kolyunya)
|
||||
- Bug #13848: `yii\di\Instance::ensure()` wasn't throwing an exception when `$type` is specified and `$reference` object isn't instance of `$type` (c-jonua)
|
||||
- Enh #13226: `yii cache` command now warns about the fact that it's not able to flush APC cache from console (samdark)
|
||||
- Bug #13689: Fixed handling of errors in closures (mikehaertl)
|
||||
|
||||
@ -165,7 +165,7 @@ class AccessRule extends Component
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ip the IP address
|
||||
* @param string|null $ip the IP address
|
||||
* @return bool whether the rule applies to the IP address
|
||||
*/
|
||||
protected function matchIP($ip)
|
||||
@ -174,7 +174,14 @@ class AccessRule extends Component
|
||||
return true;
|
||||
}
|
||||
foreach ($this->ips as $rule) {
|
||||
if ($rule === '*' || $rule === $ip || (($pos = strpos($rule, '*')) !== false && !strncmp($ip, $rule, $pos))) {
|
||||
if ($rule === '*' ||
|
||||
$rule === $ip ||
|
||||
(
|
||||
$ip !== null &&
|
||||
($pos = strpos($rule, '*')) !== false &&
|
||||
strncmp($ip, $rule, $pos) === 0
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user