Description | We use a testlink integration and it stopped working upon upgrade to 2.25.2 I found that the apache log was filled with errors such as:
[Mon Jun 21 17:09:33.649879 2021] [php7:notice] [pid 22170] [client 10.192.3.xxx:24334] [mantisconnect.php] Error Type: APPLICATION WARNING #300,\nError Description: String "unknown_file_extension" not found.\nStack Trace:\nlang_api.php L307 trigger_error(<string>'300', <integer>512)\nfile_api.php L346 lang_get(<string>'unknown_file_extension')\nfile_api.php L498 file_get_icon_url(<string>'restore_session.18')\nmc_issue_api.php L510 file_get_visible_attachments(<integer>7803)\nmc_issue_api.php L1698 mci_issue_get_attachments(<integer>7803, <integer>0)\nmc_issue_api.php L86 mci_issue_data_as_array(<Object><BugData> ( [attachment_count] => NULL, [bugnotes_count] => NULL, [bug_text_id] => '7803' ), <integer>44, <string>'english')\nUnknownFile L? mc_issue_get(<string>'testlink', <string>'REDACTED', <integer>7803)\nmantisconnect.php L89 handle()\n
[Mon Jun 21 17:09:33.726040 2021] [php7:notice] [pid 22076] [client 10.192.3.xxx:24336] [mantisconnect.php] Error Type: APPLICATION WARNING #300,\nError Description: String "unknown_file_extension" not found.\nStack Trace:\nlang_api.php L307 trigger_error(<string>'300', <integer>512)\nfile_api.php L346 lang_get(<string>'unknown_file_extension')\nfile_api.php L498 file_get_icon_url(<string>'restore_session.20')\nmc_issue_api.php L510 file_get_visible_attachments(<integer>7813)\nmc_issue_api.php L1698 mci_issue_get_attachments(<integer>7813, <integer>0)\nmc_issue_api.php L86 mci_issue_data_as_array(<Object><BugData> ( [attachment_count] => NULL, [bugnotes_count] => NULL, [bug_text_id] => '7813' ), <integer>44, <string>'english')\nUnknownFile L? mc_issue_get(<string>'testlink', <string>'REDACTED', <integer>7813)\nmantisconnect.php L89 handle()\n
[Mon Jun 21 17:09:33.798702 2021] [php7:notice] [pid 21349] [client 10.192.3.xxx:24350] [mantisconnect.php] Error Type: APPLICATION WARNING #300,\nError Description: String "unknown_file_extension" not found.\nStack Trace:\nlang_api.php L307 trigger_error(<string>'300', <integer>512)\nfile_api.php L346 lang_get(<string>'unknown_file_extension')\nfile_api.php L498 file_get_icon_url(<string>'joblog.55')\nmc_issue_api.php L510 file_get_visible_attachments(<integer>7824)\nmc_issue_api.php L1698 mci_issue_get_attachments(<integer>7824, <integer>0)\nmc_issue_api.php L86 mci_issue_data_as_array(<Object><BugData> ( [attachment_count] => NULL, [bugnotes_count] => NULL, [bug_text_id] => '7824' ), <integer>44, <string>'english')\nUnknownFile L? mc_issue_get(<string>'testlink', <string>'REDACTED', <integer>7824)\nmantisconnect.php L89 handle()\n
[Mon Jun 21 17:09:34.543093 2021] [php7:notice] [pid 21909] [client 10.192.3.xxx:24351] [mantisconnect.php] Error Type: APPLICATION WARNING #300,\nError Description: String "unknown_file_extension" not found.\nStack Trace:\nlang_api.php L307 trigger_error(<string>'300', <integer>512)\nfile_api.php L346 lang_get(<string>'unknown_file_extension')\nfile_api.php L498 file_get_icon_url(<string>'m365-debug-0.err')\nmc_issue_api.php L510 file_get_visible_attachments(<integer>7814)\nmc_issue_api.php L1698 mci_issue_get_attachments(<integer>7814, <integer>0)\nmc_issue_api.php L86 mci_issue_data_as_array(<Object><BugData> ( [attachment_count] => NULL, [bugnotes_count] => NULL, [bug_text_id] => '7814' ), <integer>44, <string>'english')\nUnknownFile L? mc_issue_get(<string>'testlink', <string>'REDACTED', <integer>7814)\nmantisconnect.php L89 handle()\n
It is easy to fix. I simply had to go to to core/file_api.php and edit the function:
function file_get_icon_url( $p_display_filename ) {
$t_file_type_icons = config_get_global( 'file_type_icons' );
$t_ext = mb_strtolower( pathinfo( $p_display_filename, PATHINFO_EXTENSION ) );
if( is_blank( $t_ext ) || !isset( $t_file_type_icons[$t_ext] ) ) {
$t_ext = '?';
}
return array(
'url' => $t_file_type_icons[$t_ext],
// 'alt' => $t_ext == '?' ? lang_get( 'unknown_file_extension' ) : $t_ext <------------- Disabled
);
}
This simple change causes the issue to disappear and the Mantis and testlink marriage to once again be happy.
EDIT (dregad): added markdown formatting) |
---|