Dependency Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0037418 | mantisbt | bugtracker | public | 2026-09-24 03:24 | 2026-09-24 04:00 |
| Reporter | 123 | Assigned To | dregad | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 2.28.4 | ||||
| Target Version | 2.29.0 | Fixed in Version | 2.29.0 | ||
| Summary | 0037418: PHP 8.4: error messages lose their parameters ("Issue "0" not found") | ||||
| Description | On PHP 8.4, MantisBT 2.28.x displays error messages with empty parameters. For example, when I open a non-existent issue, I get Issue "0" not found. instead of the id I requested. I first noticed it in a plugin I maintain (Calendar): plugin_error() preceded by error_parameters() shows the same "0", so both core and plugin errors are affected. Cause: in PHP 8.4, trigger_error( ..., E_USER_ERROR ) first emits an E_DEPRECATED ("Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, ..."), and only then the actual error. Both go through error_handler(). After handling the deprecation notice, error_handler() resets $g_error_parameters = array() at its end. So when the real E_USER_ERROR arrives, the parameters are already gone: vsprintf() receives empty strings, %d placeholders render as 0 and %s ones as empty. | ||||
| Steps To Reproduce | Run MantisBT 2.28.4 on PHP 8.4. Minimal PHP reproduction of the double handler call: <?php | ||||
| Additional Information | As far as I can tell, this is fixed in master as part of 0036812, in particular by commit 7c8b6b92b "Treat $g_error_parameters as a stack". I am filing this separately because 0036812 and its duplicate 0037353 describe only the deprecation notice, not this user-visible symptom. 2.28.x officially supports PHP 8.4 (0035216 was fixed in 2.28.0, and PHP_MAX_VERSION is not set), yet its child 0036812 was only fixed in 2.29.0. So every 2.28.x installation on a supported PHP version shows wrong error messages. Would you consider backporting the fix, or at least the $g_error_parameters part of it, to 2.28.x? Cherry-picking 7c8b6b92b alone would not work on 2.28, since it relies on error_string() consuming the parameters it uses (905f74e51). A minimal fix for 2.28 could be to keep $g_error_parameters when error_handler() handles an E_DEPRECATED: if( $p_type != E_DEPRECATED ) { If you are interested, I would be glad to submit a PR against master-2.28 with this change, tested on 2.28.4 with PHP 8.4. | ||||
| Tags | PHP 8.4 | ||||
|
Thanks for the report. This is a known issue, which is a side-effect of the deprecation tracked by 0036812, so I did not bother opening a separate Issue for it. As you pointed out, it is already fixed in master branch since PR https://github.com/mantisbt/mantisbt/pull/2263 was merged (MantisBT master 3c8255d1). 2.29.0 will be released very soon, and there is no plan to backport this and release a hotfix version for the 2.28 branch. The workaround is to squelch the E_DEPRECATED notices, by changing your error_reporting setting in php.ini (you probably should not have them on in a production systemanyway). Or patch your local instance as you see fit, but this is not supported. |
|
related to
child of
duplicate of