- Application: MantisBT 2.28.0
- PHP version: 8.x
- Deployment: Native WebStation (Synology DSM 7.3.2)
Issue Description:
- When creating a new issue, MantisBT displayed:
INTERNAL APPLICATION ERROR
- No email was generated and no record was inserted into mantis_email_table for the "Issue reported" notification.
Bugnote notifications worked correctly.
Error Message:
email_store(): Argument #4 ($p_headers) must be of type array, null given,
called in core/email_api.php on line 1807
Root Cause
In the email_bug_info_to_one_user() function, the call to:
Code: Select all
email_store( $t_user_email, $t_subject, $t_message, $t_mail_headers );The email_store() function signature enforces:
array $p_headers = []
Under PHP 8, passing null to a strictly typed array parameter results in a TypeError, which terminates execution before the email queue insert occurs.
This behavior is stricter in PHP 8 compared to PHP 7.
Fix Implemented
The call was modified to guarantee that the 4th parameter is always an array:
Code: Select all
$t_id = email_store(
$t_user_email,
$t_subject,
$t_message,
$t_mail_headers ?? []
);Result
New issue notifications are now correctly inserted into mantis_email_table.
No more internal application error.
Fully compatible with PHP 8 strict type enforcement.
Impact
This fix resolves a PHP 8 compatibility issue affecting only the "new issue" notification path.
Bugnote notifications were not affected.