From cb344c5bd7d9c339c831053ec8beb38786e4ce8b Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sun, 1 Jan 2023 15:09:54 +0000 Subject: [PATCH] [REF][PHP8.2] Avoid dynamic properties in civicrm_api3 class --- api/class.api.php | 85 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/api/class.api.php b/api/class.api.php index 21a4190b70..4def2f76d4 100644 --- a/api/class.api.php +++ b/api/class.api.php @@ -89,6 +89,89 @@ */ class civicrm_api3 { + /** + * Are we performing a local or remote API call? + * + * @var bool + */ + public $local = TRUE; + + /** + * Array of inputs to pass to `call`, if param not passed directly + * + * @var array + * @internal + */ + public $input = []; + + /** + * Holds the result of the last API request. + * If the request has not yet run, lastResult will be empty. + * + * @var \stdClass + * @internal + */ + public $lastResult; + + /** + * When making a remote API request, + * $uri will be the path to the remote server's API endpoint + * + * @var string|null + * @internal + */ + public $uri = NULL; + + /** + * When making a remote API request, + * $key will be sent as part of the request + * + * @var string|null + * @internal + */ + public $key = NULL; + + /** + * When making a remote API request, + * $api_key will be sent as part of the request + * + * @var string|null + * @internal + */ + public $api_key = NULL; + + /** + * When making a remote API request, + * $referer holds the Referer header value to be sent as part of the request + * + * @var string|null + * @internal + */ + public $referer = NULL; + + /** + * When making a remote API request, + * $useragent holds the User-Agent header value to be sent as part of the request + * + * @var string|null + * @internal + */ + public $useragent = NULL; + + /** + * Reference to the CRM_Core_Config singleton + * + * @var CRM_Core_Config + */ + protected $cfg; + + /** + * The current entity, which actions should be performed against + * + * @var string|null + */ + protected $currentEntity = NULL; + /** * Class constructor. * @@ -97,7 +180,7 @@ class civicrm_api3 { public function __construct($config = NULL) { $this->local = TRUE; $this->input = []; - $this->lastResult = []; + $this->lastResult = new stdClass(); if (!empty($config) && !empty($config['server'])) { // we are calling a remote server via REST $this->local = FALSE; -- 2.25.1