Jump to content

Hook Error with array


sol2010

Recommended Posts

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;

 
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 by sol2010
Link to comment
Share on other sites

  • 2 weeks later...

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?

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated