TypeError guessFileExtension Errors

Problem

You see the following error in your PHP error_log file or in the Activity Log at Configuration () > System Logs when importing certain emails into the support ticket system:

TypeError: Return value of WHMCS\File::guessFileExtension() must be of the type string, null returned in /path/to/whmcs/vendor/whmcs/whmcs-foundation/lib/File.php

Cause

The fileinfo function is missing or disabled in your server’s PHP configuration.

This is a standard PHP function. WHMCS requires it in order to identify the file extension of email attachments when importing them into the support ticket system.

Solution

Work with your system administrator or hosting provider to enable the fileinfo function in your PHP configuration.

To confirm that you have successfully enabled it:

  1. Log in to the WHMCS Admin Area.
  2. Go to Utilities > System > PHP Info.
  3. Find the fileinfo extension in the list and check its status:
    The fileinfo extension in PHP Info

Last modified: September 10, 2024