sol2010 Posted November 24, 2022 Share Posted November 24, 2022 (edited) I am using this hook to get additional notifications when a support department ticket is opened. However, after upgrade to PHP 8.1 and the new WHMCS version, I am getting an error; https://github.com/solaceten/WHMCS-Hooks/blob/main/includes/hooks/emergencyticket.php I'm getting an error from the code ' if (in_array($departmentid, $criticaldept)) { ' (line 26) Something went wrong and we couldn't process your request. Please go back to the previous page and try again. TypeError: in_array(): Argument #2 ($haystack) must be of type array, int given in /home/ domain /public_html/clients/includes/hooks/emergencyticket.php:26 Here is the relevent code... why is the array an issue ? function hook_send_emergency_email($vars) { $criticaldept = 5; // id of emergency department $departmentid = $vars['deptid']; $company = $vars['companyname']; if (in_array($vars['deptid'], $criticaldept)) { Edited November 24, 2022 by sol2010 0 Quote Link to comment Share on other sites More sharing options...
bear Posted November 24, 2022 Share Posted November 24, 2022 10 hours ago, sol2010 said: Here is the relevent code... why is the array an issue ? Because that's not an array. Try: $criticaldept = array('5'); // id of emergency department 0 Quote Link to comment Share on other sites More sharing options...
sol2010 Posted December 3, 2022 Author Share Posted December 3, 2022 Thank you @bear, that worked. 0 Quote Link to comment Share on other sites More sharing options...
piticu81 Posted December 4, 2022 Share Posted December 4, 2022 i get this error TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /var/www/vhosts/ if (!in_array("error", $result)) { logModuleCall("Xtream UI ONE", "Custom Fields", "Custom Fields Created", $custom_fields); } anyone can help me with this? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted December 14, 2022 Share Posted December 14, 2022 Since $result isn't defined in the code this was about, your code is likely not the same. Can you show your code? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.