mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Check array keys existence prior to their usage when removing methods in CustomMethods
This commit is contained in:
parent
79a89e751d
commit
52a039f631
@ -282,10 +282,15 @@ trait CustomMethods
|
|||||||
if (!isset(self::$extra_methods[$class][$method])) {
|
if (!isset(self::$extra_methods[$class][$method])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$methodInfo = self::$extra_methods[$class][$method];
|
$methodInfo = self::$extra_methods[$class][$method];
|
||||||
|
|
||||||
if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) {
|
if (
|
||||||
|
// always check for property
|
||||||
|
(isset($methodInfo['property']) && $methodInfo['property'] === $property) &&
|
||||||
|
// check for index only if provided (otherwise assume true)
|
||||||
|
(($index && isset($methodInfo['index']) && $methodInfo['index'] === $index) || true)
|
||||||
|
) {
|
||||||
unset(self::$extra_methods[$class][$method]);
|
unset(self::$extra_methods[$class][$method]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user