From 918511552d55abaf235b24c6dc94d81483308e78 Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Mon, 15 Jun 2020 07:17:34 +0100 Subject: [PATCH] PropertyBag call deprecatedFunctionWarning on array access to custom props --- Civi/Payment/PropertyBag.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Civi/Payment/PropertyBag.php b/Civi/Payment/PropertyBag.php index 97d8f03430..bf94a02b0d 100644 --- a/Civi/Payment/PropertyBag.php +++ b/Civi/Payment/PropertyBag.php @@ -130,6 +130,10 @@ class PropertyBag implements \ArrayAccess { return $this->getCustomProperty($offset, 'default'); } catch (BadMethodCallException $e) { + \CRM_Core_Error::deprecatedFunctionWarning( + "Use \$propertyBag->setCustomProperty('$offset', \$value) and then \$propertyBag->getCustomProperty('$offset') instead.", + "Accessing a not-set custom property via array access is deprecated. We're returning NULL for now but you should update your code." + ); $this->legacyWarning($e->getMessage() . " calling getCustomProperty on a non-set property will result in a BadMethodCallException exception, but for your legacy use we have returned NULL. Please update your code."); return NULL; } -- 2.25.1