View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0032086||mantisbt||bugtracker||public||2023-03-01 02:49||2023-04-13 15:42|
|Target Version||2.25.7||Fixed in Version||2.25.7|
|Summary||0032086: IssueViewPageCommand.php line 135: 'Undefined array key "version" with php 8.1.16|
I need to switch from php7 to php 8.1+. To this end I upgraded from mantis 2.25.2 to 2.25.6
With 2.25.6/php 8.1.16 I see the system warning (errors enabled):
This warning is not shown up with mantis 2.25.6 on my older php 7.4.21 .
|Steps To Reproduce|
PHP Version 8.1.16
|Tags||No tags attached.|
|related to||0031889||closed||dregad||Product Version / Target Version - Date missing|
|has duplicate||0032391||closed||atrol||Depois de criar tarefa lista mas não abre|
|related to||0032098||closed||dregad||Long initial delay with mantis 2.25.6 and php 8.1.16|
|related to||0032353||closed||atrol||Getting Undefined index: target_version when viewing bug|
@tk be aware that PHP 8.1 is not officially supported, see this note 0031928:0067317
Thanks for the bug report @tk. After analysis, the regression is actually much worse than a simple PHP warning...
For the record, on PHP 7.4, this is preceded by
I failed to consider that the mci_issue_data_as_array() API function actually removes null keys and empty arrays from the returned Issue data, so the newly introduced prepared_version_string() should check for array key existence.
I'm not sure how this could have escaped me while testing... Sorry about that.
I was puzzled that the regression couldn't be reproduced on this tracker, and embarrassingly it took me a while to realize that it's due to display of version dates being disabled here (
@tk this is surprising, as I'm getting the error on PHP 7.4 too...
Anyway, fix in PR https://github.com/mantisbt/mantisbt/pull/1869, testing and feedback welcome.
I've tested your patch successfully with 8.0.28. Test with php 8.1 will follow as soon as my environment is reconfigured for that again.
As an additional observation, setup of initial mantis window as well as initial login to 2.25.6 with php8.0 takes considerably longer than same installation with php7.4., at least in my scenario with LDAP authentication against MS AD service. Should I open another ticket?
Not really sure what you mean exactly by setup of initial mantis window and initial login .
Regarding performance I've seen rather exactly 60sec delay from call of mantis page in browser until display of login page. After clearance of all browser caches the problem appears to be gone, so this is hard to reproduce (but complicated to explain to my users). I'll see...
If it's exactly 60s, then maybe there's a timeout somewhere... If you're somehow able to reproduce the problem, maybe you can try to identify the offending request using the browser's network monitor (e.g. ctrl+shift+E on Firefox)
opened 0032098 for delay problem
MantisBT: master-2.25 6671bc5c
|Fix error when displaying Issue without Version
Commit d9464fe8132f6cfd694625c8d050575aed95d5ba introduced a regression
when displaying an Issue without Product, Target or Fixed In Version:
APPLICATION ERROR 1601 - Version "" not found
PHP Notice (or Warning on 8.1+): Undefined array key "version"
This is because mci_issue_data_as_array() removes null keys and empty
arrays from the Issue data, so the IssueViewPageCommand needs to check
for array key existence before calling prepared_version_string().
Fixes 0032086, 0031889
|mod - core/commands/IssueViewPageCommand.php||Diff File|