View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0036812 | mantisbt | code cleanup | public | 2026-01-02 16:51 | 2026-09-24 03:59 |
| Reporter | dregad | Assigned To | dregad | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Target Version | 2.29.0 | Fixed in Version | 2.29.0 | ||
| Summary | 0036812: PHP 8.4: Passing E_USER_ERROR to trigger_error() is deprecated | ||||
| Description | Example: Today we actually do this all over the place...
shows 248 occurrences in the code, plus 3 in the documentation | ||||
| Tags | PHP 8.4 | ||||
| parent of | 0037418 | resolved | dregad | PHP 8.4: error messages lose their parameters ("Issue "0" not found") |
| has duplicate | 0037353 | closed | atrol | PHP 8.4: Passing E_USER_ERROR to trigger_error() is deprecated since 8.4 |
| related to | 0037372 | resolved | dregad | HTTP 500 error when activating filter criteria |
| child of | 0035216 | closed | dregad | PHP 8.4 compatibility |
|
This is not going to be a trivial fix.
|
|
|
PR https://github.com/mantisbt/mantisbt/pull/2263 (still work-in-progress at this stage, nearly done though. |
|
|
MantisBT: master 13dd17b0 2026-01-04 13:13 Details Diff |
New error_output() function Extracting the code that displays the error message from our standard error_handler() into a new function. This is a preliminary refactoring, required to shift from our current usage of trigger_error() with E_USER_ERROR, which has been deprecated in PHP 8.4. For now it just prints the Exception's message (not localized). Issue 0036812 |
Affected Issues 0036812 |
|
| mod - core/error_api.php | Diff File | ||
|
MantisBT: master 388f105a 2026-01-04 15:17 Details Diff |
Process Exceptions directly in the handler Until now, error_exception_handler() was simply passing the Exception to error_handler() by calling trigger_error(). Following deprecation of passing E_USER_ERROR to trigger_error() in PHP 8.4, the hander has been modified to process the exceptions directly, calling error_output(). Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/error_api.php | Diff File | ||
|
MantisBT: master ec8a2af0 2026-01-04 19:10 Details Diff |
Use an Exception to send data to error_output() Add a new ErrorHandlerException class, extending ErrorException and used as a vector to pass error datan from error_handler() to error_output(). This is a "dummy" exception (i.e. not meant to be thrown). Add new public method getErrorType() to MantisException. Change error_output() to accept a Throwable (MantisException or ErrorHandlerException) as parameter, instead of 5 individual values. This simplifies error_exception_handler() and error_handler(). The latter creates an ErrorHandlerException based on the error and adapts it according to its type and the context. Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/error_api.php | Diff File | ||
| add - core/exceptions/ErrorHandlerException.php | Diff File | ||
| mod - core/exceptions/MantisException.php | Diff File | ||
|
MantisBT: master 7c8b6b92 2026-01-11 08:58 Details Diff |
Treat $g_error_parameters as a stack This should prevents side effects when an error is triggered while another is already being handled, which could cause error parameters to be lost. Issue 0036812 |
Affected Issues 0036812 |
|
| mod - core/error_api.php | Diff File | ||
|
MantisBT: master 905f74e5 2026-01-11 09:05 Details Diff |
error_string() accepts optional error params array Refactored the function to accept an optional $p_param parameter to provide the error parameters. This reduces dependency on the $g_error_parameters global, which is only used when $p_param is not specified or null. In this case, the function will only consume as many error parameters as required by the message string. Used parameters are removed from the stack. Issue 0036812 |
Affected Issues 0036812 |
|
| mod - core/error_api.php | Diff File | ||
|
MantisBT: master c90d1ca9 2026-01-11 11:32 Details Diff |
Generate localized error message in MantisException Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/exceptions/MantisException.php | Diff File | ||
|
MantisBT: master f9f62bb0 2026-01-11 11:45 Details Diff |
Use MantisException::getLocalizedMessage() in error_output() Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/error_api.php | Diff File | ||
|
MantisBT: master 5527c3bd 2026-01-11 11:55 Details Diff |
Deprecate ERROR constant Common uses in `trigger_error(..., ERROR)` calls must be replaced by a throw Exception. For other cases, use PHP standard constant E_USER_ERROR. Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/constant_inc.php | Diff File | ||
|
MantisBT: master 799c833d 2026-01-12 17:40 Details Diff |
Move error message localization to Trait Avoids code duplication, as this behavior is needed both in our native Exceptions (derived from MantisException), and the ErrorHandlerException (derived from PHP's ErrorException). Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/exceptions/ErrorHandlerException.php | Diff File | ||
| add - core/exceptions/LocalizedErrorMessageTrait.php | Diff File | ||
| mod - core/exceptions/MantisException.php | Diff File | ||
|
MantisBT: master 28960185 2026-01-12 17:42 Details Diff |
Adapt Autoloader to handle Traits Issue 0036812 |
Affected Issues 0036812 |
|
| mod - core.php | Diff File | ||
|
MantisBT: master 7d425ae4 2026-01-12 19:17 Details Diff |
Build error message and location in error_output() It is not necessary to build the error message in error_handler() since all the necessary information including localized message, filename and line number is partof the ErrorHandlerException. This simplifies error_handler(), which just needs to build the Exception as appropriate and call error_output(). We also don't need the setCode() and setMessage() methods in ErrorHandlerException anymore. Issue 0036812 |
Affected Issues 0036812 |
|
| mod - core/error_api.php | Diff File | ||
| mod - core/exceptions/ErrorHandlerException.php | Diff File | ||
|
MantisBT: master 4d213ec0 2026-01-12 19:18 Details Diff |
Adapt plugin_errors() to E_USER_ERROR Switch from ERROR to E_USER_ERROR. Implement a mechanism to provide backwards compatibility for plugins calling trigger_error(), capturing the error type and throwing an exception with a new ERROR_PLUGIN_RUNTIME error code, necessary because Exception code must be integer and plugin errors are identified by a string. Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/constant_inc.php | Diff File | ||
| mod - core/plugin_api.php | Diff File | ||
| mod - lang/strings_english.txt | Diff File | ||
|
MantisBT: master fc35a389 2026-01-18 07:57 Details Diff |
Do not display generic error details if none provided Issue 0036812 |
Affected Issues 0036812 |
|
| mod - core/error_api.php | Diff File | ||
|
MantisBT: master 0d7943d2 2026-01-18 10:51 Details Diff |
New db_error_as_array() function Used to to provide database error parameters to the constructor when throwing an Exception. Replaces db_error(), which is now deprecated. Issue 0036812 |
Affected Issues 0036812 |
|
| mod - core/database_api.php | Diff File | ||
|
MantisBT: master 4745c1ac 2026-01-19 12:46 Details Diff |
Remove uncessary ERROR_GENERIC error db_query() will throw an exception if query execution fails. Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - manage_user_prune.php | Diff File | ||
| mod - proj_doc_update.php | Diff File | ||
|
MantisBT: master 0080674d 2026-07-18 11:55 Details Diff |
Convert trigger_error(E_USER_ERROR) to throw Exception (api) Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - api/soap/mc_file_api.php | Diff File | ||
|
MantisBT: master 59f3877e 2026-07-18 11:57 Details Diff |
Convert trigger_error(E_USER_ERROR) to throw Exception (classes) Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/classes/DbQuery.class.php | Diff File | ||
| mod - core/classes/IssueStatusChangeTimelineEvent.class.php | Diff File | ||
|
MantisBT: master 56135c1c 2026-07-18 19:20 Details Diff |
Convert trigger_error(E_USER_ERROR) to throw Exception (plugins) Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - plugins/MantisGraph/core/graph_api.php | Diff File | ||
| mod - plugins/XmlImportExport/ImportXml/Issue.php | Diff File | ||
| mod - plugins/XmlImportExport/XmlImportExport.php | Diff File | ||
|
MantisBT: master 5a797a0a 2026-07-22 17:20 Details Diff |
Convert trigger_error(E_USER_ERROR) to throw Exception (doc) Adapt code samples in documentation. Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - docbook/Admin_Guide/en-US/Customizing.xml | Diff File | ||
| mod - docbook/Developers_Guide/en-US/Plugins_Building.xml | Diff File | ||
|
MantisBT: master 121dd1b6 2026-08-27 12:45 Details Diff |
Convert trigger_error(E_USER_ERROR) to throw Exception Fixes 0036812 |
Affected Issues 0036812, 0037372 |
|
| mod - account_prefs_inc.php | Diff File | ||
| mod - account_prof_edit_page.php | Diff File | ||
| mod - account_prof_menu_page.php | Diff File | ||
| mod - account_prof_update.php | Diff File | ||
| mod - account_sponsor_page.php | Diff File | ||
| mod - account_sponsor_update.php | Diff File | ||
| mod - account_update.php | Diff File | ||
| mod - adm_config_page.php | Diff File | ||
| mod - adm_config_set.php | Diff File | ||
| mod - bug_actiongroup.php | Diff File | ||
| mod - bug_actiongroup_add_note_inc.php | Diff File | ||
| mod - bug_actiongroup_page.php | Diff File | ||
| mod - bug_change_status_page.php | Diff File | ||
| mod - bug_monitor_delete.php | Diff File | ||
| mod - bug_reminder.php | Diff File | ||
| mod - bug_reminder_page.php | Diff File | ||
| mod - bug_report.php | Diff File | ||
| mod - bug_report_page.php | Diff File | ||
| mod - bug_revision_view_page.php | Diff File | ||
| mod - bug_set_sponsorship.php | Diff File | ||
| mod - bug_update.php | Diff File | ||
| mod - bug_update_page.php | Diff File | ||
| mod - bugnote_edit_page.php | Diff File | ||
| mod - bugnote_set_view_state.php | Diff File | ||
| mod - bugnote_update.php | Diff File | ||
| mod - changelog_page.php | Diff File | ||
| mod - file_download.php | Diff File | ||
| mod - lost_pwd.php | Diff File | ||
| mod - lost_pwd_page.php | Diff File | ||
| mod - manage_columns_copy.php | Diff File | ||
| mod - manage_filter_edit_page.php | Diff File | ||
| mod - manage_filter_edit_update.php | Diff File | ||
| mod - manage_plugin_update.php | Diff File | ||
| mod - manage_proj_cat_add.php | Diff File | ||
| mod - manage_proj_cat_copy.php | Diff File | ||
| mod - manage_proj_cat_update.php | Diff File | ||
| mod - manage_proj_custom_field_copy.php | Diff File | ||
| mod - manage_proj_user_copy.php | Diff File | ||
| mod - manage_proj_ver_add.php | Diff File | ||
| mod - manage_proj_ver_copy.php | Diff File | ||
| mod - manage_user_create.php | Diff File | ||
| mod - manage_user_edit_page.php | Diff File | ||
| mod - plugin.php | Diff File | ||
| mod - plugin_file.php | Diff File | ||
| mod - proj_doc_add.php | Diff File | ||
| mod - proj_doc_update.php | Diff File | ||
| mod - return_dynamic_filters.php | Diff File | ||
| mod - roadmap_page.php | Diff File | ||
| mod - signup.php | Diff File | ||
| mod - tag_create.php | Diff File | ||
| mod - verify.php | Diff File | ||
| mod - verify_email.php | Diff File | ||
| mod - view_all_set.php | Diff File | ||
| mod - view_user_page.php | Diff File | ||
|
MantisBT: master 66a98f10 2026-08-28 19:33 Details Diff |
Convert trigger_error(E_USER_ERROR) to throw Exception (core) Fixes 0036812 |
Affected Issues 0036812 |
|
| mod - core/api_token_api.php | Diff File | ||
| mod - core/authentication_api.php | Diff File | ||
| mod - core/billing_api.php | Diff File | ||
| mod - core/bug_api.php | Diff File | ||
| mod - core/bug_group_action_api.php | Diff File | ||
| mod - core/bug_revision_api.php | Diff File | ||
| mod - core/bugnote_api.php | Diff File | ||
| mod - core/category_api.php | Diff File | ||
| mod - core/collapse_api.php | Diff File | ||
| mod - core/columns_api.php | Diff File | ||
| mod - core/crypto_api.php | Diff File | ||
| mod - core/custom_field_api.php | Diff File | ||
| mod - core/database_api.php | Diff File | ||
| mod - core/email_api.php | Diff File | ||
| mod - core/email_queue_api.php | Diff File | ||
| mod - core/file_api.php | Diff File | ||
| mod - core/filter_api.php | Diff File | ||
| mod - core/form_api.php | Diff File | ||
| mod - core/gpc_api.php | Diff File | ||
| mod - core/graphviz_api.php | Diff File | ||
| mod - core/helper_api.php | Diff File | ||
| mod - core/ldap_api.php | Diff File | ||
| mod - core/news_api.php | Diff File | ||
| mod - core/plugin_api.php | Diff File | ||
| mod - core/print_api.php | Diff File | ||
| mod - core/profile_api.php | Diff File | ||
| mod - core/project_api.php | Diff File | ||
| mod - core/project_hierarchy_api.php | Diff File | ||
| mod - core/relationship_api.php | Diff File | ||
| mod - core/session_api.php | Diff File | ||
| mod - core/sponsorship_api.php | Diff File | ||
| mod - core/string_api.php | Diff File | ||
| mod - core/summary_api.php | Diff File | ||
| mod - core/tag_api.php | Diff File | ||
| mod - core/tokens_api.php | Diff File | ||
| mod - core/user_api.php | Diff File | ||
| mod - core/user_pref_api.php | Diff File | ||
| mod - core/utility_api.php | Diff File | ||
|
MantisBT: master 4d108487 2026-08-28 19:41 Details Diff |
category_validate_assigned_to() always throws The function, introduced with the new Category commands (Issue 0032470, commit 1358aa93108a4e5fa36079955161733f5ba3283d), was modified to always throw a ClientException. The $p_throw_exception parameter has become useless and was removed. Fixes 0036812 |
Affected Issues 0032470, 0036812 |
|
| mod - core/category_api.php | Diff File | ||
| mod - core/commands/CategoryAddCommand.php | Diff File | ||
| mod - core/commands/CategoryUpdateCommand.php | Diff File | ||
|
MantisBT: master 669d92b7 2026-09-07 07:45 Details Diff |
Remove duplicate `use` statement Fixes 0037372, 0036812 |
Affected Issues 0036812, 0037372 |
|
| mod - return_dynamic_filters.php | Diff File | ||