From 02e31932f838b35620eadc472e96dd7ff382b86a Mon Sep 17 00:00:00 2001 From: Joe Chenevey Date: Tue, 8 Jan 2019 15:02:22 -0500 Subject: [PATCH 1/2] Update Object.php Check to ensure `self::$extra_methods[$this->class][$method]` exists before trying to retrieve it. Prevents a bunch of notices from being generated. --- core/Object.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/Object.php b/core/Object.php index 0a28bae0a..7cc0181a2 100644 --- a/core/Object.php +++ b/core/Object.php @@ -908,10 +908,12 @@ abstract class SS_Object { $methods = $this->findMethodsFromExtension($extension); if ($methods) { foreach ($methods as $method) { - $methodInfo = self::$extra_methods[$this->class][$method]; + if (isset(self::$extra_methods[$this->class][$method])) { + $methodInfo = self::$extra_methods[$this->class][$method]; - if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) { - unset(self::$extra_methods[$this->class][$method]); + if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) { + unset(self::$extra_methods[$this->class][$method]); + } } } From 1bc51a1c3949260e488b88fc2dd1fcf38b14bf39 Mon Sep 17 00:00:00 2001 From: Joe Chenevey Date: Tue, 8 Jan 2019 15:28:15 -0500 Subject: [PATCH 2/2] Update Object.php Switch to an early `continue` rather than wrapping contents of `foreach` in an `if` and indenting. --- core/Object.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/Object.php b/core/Object.php index 7cc0181a2..21a741511 100644 --- a/core/Object.php +++ b/core/Object.php @@ -908,12 +908,14 @@ abstract class SS_Object { $methods = $this->findMethodsFromExtension($extension); if ($methods) { foreach ($methods as $method) { - if (isset(self::$extra_methods[$this->class][$method])) { - $methodInfo = self::$extra_methods[$this->class][$method]; + if (!isset(self::$extra_methods[$this->class][$method])) { + continue; + } + + $methodInfo = self::$extra_methods[$this->class][$method]; - if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) { - unset(self::$extra_methods[$this->class][$method]); - } + if ($methodInfo['property'] === $property && $methodInfo['index'] === $index) { + unset(self::$extra_methods[$this->class][$method]); } }