TypeError: Return value of WHMCS\File::guessFileExtension() must be of the type string
Symptom
A TypeError
referencing the guessFileExtension
function appears in your PHP error_log
file or the Activity Log 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:
- Log in to the WHMCS Admin Area.
- Go to Utilities > System > PHP Info.
- Find the
fileinfo
extension in the list and check its status: