From: Rich Lott / Artful Robot Date: Mon, 15 Jun 2020 06:17:34 +0000 (+0100) Subject: PropertyBag call deprecatedFunctionWarning on array access to custom props X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=918511552d55abaf235b24c6dc94d81483308e78;p=civicrm-core.git PropertyBag call deprecatedFunctionWarning on array access to custom props --- 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; }