I have updated PHP 7.3 to version 8.1 but with the following code, I get a warning:
$this->m_intEventId =
$this->m_objMaintenanceRequest->getEventIds()[CEventSubType::WORKORDER_STATUS_UPDATED]
?? $this->m_objMaintenanceRequest->getEventIds()[CEventSubType::WORKORDER_CLOSED]
?? $this->m_objMaintenanceRequest->getEventIds()[CEventSubType::WORKORDER_CLOSED_AND_WORK_COMPLETED]
?? $this->m_objMaintenanceRequest->getEventIds()[CEventSubType::WORKORDER_COMPLETED];
The warning is
Trying to access array offset on value of type null
We can use isset()
, but in this case, do we need to check individual index with isset()
? Is there a way to resolve this issue?