View Issue Details

IDProjectCategoryView StatusLast Update
0026439mantisbtuipublic2020-03-15 15:23
Reporterxandros_darkstorm Assigned Todregad  
Status closedResolutionfixed 
Target Version2.24.0Fixed in Version2.24.0 
Summary0026439: Issue list throws warning on every issue without bug notes.

When user opens issue list, the following warnings appear for each issue without bug notes:
"SYSTEM NOTICE: 'Trying to access array offset on value of type bool' in: <filepath_to_mantis>\core\columns_api.php' line 1236"
"SYSTEM NOTICE: 'Trying to access array offset on value of type bool' in: <filepath_to_mantis>\core\columns_api.php' line 1237"

If issue gets a comment (bug note) two warnings disappear.
It was a fresh installation and no additional plugins installed, when this bug was noticed.

Steps To Reproduce
  1. Install Mantis. Create a project.
  2. Create an issue.
  3. Go back to the issue list.
  4. Receive 2 "SYSTEM NOTICE" warnings.
  5. Open newly created issue.
  6. Add a comment on it.
  7. Go back to the issue list.
  8. No warnings anymore; number 1 appears in a bug notes column for the issue.
Additional Information

Server configuration:
PHP 7.4.0
MySQL 8.0.18
Nginx 1.17.6
Windows Server 2008 R2 Datacenter

I have done some research and found that function "print_column_bugnotes_count" in "columns_api.php" causes the problem -- first if condition checks if "$t_bugnote_stats" is null, but never checks if it is "false". $t_bugnote_stats receives boolean value "false" from "bug_api.php" on line 1687 in foreach loop, which assigns that value for all issues without bug notes.
By modifying line 1235 to "if( null !== $t_bugnote_stats && $t_bugnote_stats !== false)" in file "columns_api.php" i resolved the problem.

TagsPHP 7.4




2019-12-08 20:52


warnings.png (74,693 bytes)   
warnings.png (74,693 bytes)   


2019-12-09 08:22

developer   ~0063203

Thanks for the detailed bug report.

This problem is specific to PHP 7.4, due to implementation of

In earlier versions, Array dereferencing a scalar value which is not a string silently yields NULL, i.e. without issuing an error message. (source: PHP manual, see note under example 7).



2019-12-09 10:52

developer   ~0063214


Related Changesets

MantisBT: master 8dc5ead4

2019-12-09 10:48:05


Details Diff
bug_get_bugnote_stats() returns array|false, not NULL

In PHP 7.3 and earlier, dereferencing a non-array variable simply
returns NULL; starting with 7.4, a SYSTEM NOTICE is triggered.

Adjusting the code to make sure the stats have indeed been returned
(i.e. we got an array) instead of relying on a `!== null` check, which
in any case wrong since bug_get_bugnote_stats() returns false, not NULL.

Also update PHPDoc for bug_get_bugnote_stats() to reflect that.

Fixes 0026439
Affected Issues
mod - core/bug_api.php Diff File
mod - core/columns_api.php Diff File