Code improvements
-
A fix is required in omnisend-connect plugin to address warnings for out of bounds array key access observed in PHP error logs, e.g.:
2022/09/27 13:10:16 [error] 1181#1181: *425 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key 0 in <..>/plugins/omnisend-connect/Manager/OmnisendContactResolver.php on line 110 PHP message: PHP Warning: Trying to access array offset on value of type null in <..>/plugins/omnisend-connect/Manager/OmnisendContactResolver.php on line 110"...
The warning is triggered when API returns empty contacts result (email is not found):
{"contacts":[],"paging":{"previous":null,"next":null,"offset":0,"limit":100}}
Proposed fix:
In omnisend-connect/Manager/OmnisendContactResolver.php, line 110:
change line from:
return $response["contacts"][0]["contactID"];
to:
return isset( $response["contacts"][0]["contactID"] ) ? $response["contacts"][0]["contactID"] : null;
- The topic ‘Code improvements’ is closed to new replies.