Error: Cannot use object of type CRM_Expenses_DAO_Expense as array (w/ possible fix)
When trying to save an existing expense, I get the error:
Error: Cannot use object of type CRM_Expenses_DAO_Expense as array in CRM_Expenses_Form_Expense->postProcess() (line 176 of /home/zymocosm/www/www/web/sites/default/files/civicrm/ext/expenses/CRM/Expenses/Form/Expense.php)
#0 /home/zymocosm/www/www/vendor/civicrm/civicrm-core/CRM/Core/Form.php(526): CRM_Expenses_Form_Expense->postProcess()
#1 /home/zymocosm/www/www/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Upload.php(152): CRM_Core_Form->mainProcess()
#2 /home/zymocosm/www/www/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Upload.php(119): CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Expenses_Form_Expense), 'upload')
#3 /home/zymocosm/www/www/vendor/civicrm/civicrm-packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Expenses_Form_Expense), 'upload')
#4 /home/zymocosm/www/www/vendor/civicrm/civicrm-packages/HTML/QuickForm/Page.php(103):
The issue seems to be with line 176 in expenses/CRM/Expenses/Form/Expense.php:
$this->processAttachments($attachmentParams, $expense['id']);
I was able to resolve by changing this line to:
$this->processAttachments($attachmentParams, $expense->id);
I am running Civi 5.40.4 and latest gitlab version of expenses, and running on php 7.3 due to issue #2 (closed)