mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #9271 from michalkleiner/pulls/4/check-array-props-in-custom-methods
FIX Check array keys existence when removing methods in CustomMethods
This commit is contained in:
commit
1265f09f4f
@ -282,10 +282,15 @@ trait CustomMethods
|
||||
if (!isset(self::$extra_methods[$class][$method])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$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
|
||||
(!$index || ($index && isset($methodInfo['index']) && $methodInfo['index'] === $index))
|
||||
) {
|
||||
unset(self::$extra_methods[$class][$method]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user