View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017270 | mantisbt | bugtracker | public | 2014-05-02 10:02 | 2014-12-08 02:08 |
| Reporter | dregad | Assigned To | dregad | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | 1.3.0dev | ||||
| Target Version | 1.3.0-beta.1 | ||||
| Summary | 0017270: PHP Deprecated, Warnings and Notices kill CLI scripts | ||||
| Description | I noticed while running PHPunit tests on PHP 5.5 that the script aborts after displaying a message when it encounters a non-critical error. Furthermore, the exit code is 0, so in the case of test scripts, they are considered successful despite not having run at all. | ||||
| Steps To Reproduce | Setup mantis with 'mysql' driver, then
Error displayed:
| ||||
| Tags | No tags attached. | ||||
|
The problem was introduced by commit 461a7115. The idea was to display "clean" error messages (i.e. without HTML formatting) when running command-line scripts, but then an exit() statement is issued regardless of the state of $g_display_errors causing a failure due to an E_DEPRECATED notice. This code needs rework, will submit a pull request later. |
|
|
Pull request https://github.com/mantisbt/mantisbt/pull/174 |
|
|
Testing
....... Time: 127 ms, Memory: 10.75Mb OK (7 tests, 7 assertions)
|
|
|
MantisBT: master 461a7115 2014-01-05 11:52 Paul Richards Details Diff |
If an error occurs, and we are running from the client sapi api, just display the raw error on a new line and do not attempt to add any html formatting |
Affected Issues 0017270 |
|
| mod - core/error_api.php | Diff File | ||
|
MantisBT: master 167ca0f6 2014-05-12 03:51 Details Diff |
Improve error handling for command-line scripts Commit 461a7115d37de79e4875b651edd10fd556a533c3 added CLI-specific handling for errors to display messages without HTML formatting. This introduced a regression, causing scripts to abort even for non-critical errors that would normally allow execution to continue (such as PHP warnings as well as system and deprecated notices). Furthermore, in that case the exit code is 0, so the caller is not able to detect the failure to take appropriate action. This improves how CLI errors are managed, making it similar to regular MantisBT error handling, i.e. - honor $g_display_errors settings - abort only for DISPLAY_ERROR_HALT (in that case exit code is 1) - don't print message if DISPLAY_ERROR_NONE - handle E_DEPRECATED error type - improve message for unhandled error types - print a debug backtrace when show_detailed_errors == ON Fixes 0017270 |
Affected Issues 0017270 |
|
| mod - core/error_api.php | Diff File | ||