Error messages within admin/test_langs.php#plugins

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mcmo
Posts: 14
Joined: 18 Oct 2016, 07:04

Error messages within admin/test_langs.php#plugins

Post by mcmo »

Hi All

I am currently validating the upgrade of our MantisBT server from the version 2.1 to 2.26.1.
Years ago I created a plugin to add some hints to some fields when entering a ticket.
It worked correctly so far. In v2.26.1, it works. At least, I haven't seen yet any issue.
But when I run the admin/test_langs.php#plugins there are errors:
Test_langs errors.png
Test_langs errors.png (23.98 KiB) Viewed 5213 times

Code: Select all

ERRORS
Line 9: Unexpected T_ARRAY token 'array'
Line 9: Unknown token '('
Line 10: Unexpected T_DOUBLE_ARROW token '=>'
Line 10: Unexpected T_DOUBLE_ARROW token '=>'
Line 10: Unexpected T_CONSTANT_ENCAPSED_STRING token ''Test cell/Cluster Server/Office workstation where the issue occurred''
Line 10: Unknown token ','
Line 11: Unexpected T_CONSTANT_ENCAPSED_STRING token ''Reseller\'s Issue Reference''
When I try to find the issue in the language file '/var/www/html/mantisbt/plugins/FieldHints/lang/strings_english.txt', I don't see anything obvious.
here are the contents of the file:

Code: Select all

<?php
# Copyright (c) 2017 HORIBA Test Automation Ltd.

$s_plugin_FieldHints_ = '';
$s_plugin_FieldHints_title = 'Field Hints';
$s_plugin_FieldHints_description = 'Plugin to add hints below the fields names';

# Hints for fields when editing
$s_plugin_FieldHints_field_hints_enum_string_REPORT=array(
    'Test Cell Name' => 'Test cell/Cluster Server/Office workstation where the issue occurred' ,
    'Reseller\'s Issue Reference' => 'Enter here the Issue ticket ID in your tracking system' ,
    'Issue Group Reference' => 'The text in this field may be used in conjunction with customer fields to create an Open Issue List',
    'Application Suites' => 'Hold CTRL to select multiple options',
    'CR/Backlog Items/Work Items and Status' => 'List of StarTeam CRs, Rhythm Backlog Items or Stories, or Azure DevOps Work Items created from this ticket and their corresponding Statuses',
    'Solution / Workaround' => 'Describe here the workaround and/or the solution',
    'Relevant Knowledgebase Article(s)' => 'code and title of the article that helped solving the issue.\nIf needed and not existing, type "to be created"',
    'Next Action' => 'Describe here the next action to solve the issue',
    'Upload Files' => 'If a file is too big to be uploaded onto this server, please use the HTA FTP server.');

$s_plugin_FieldHints_field_hints_enum_string_EDIT = array (
    'Solution / Workaround' => 'Including patch location and relevant knowledge base articles',
);

# Hints for fields when viewing
$s_plugin_FieldHints_field_hints_enum_string_VIEW = array (
    'Note' => 'If you want to upload a file, the note must be public.<br>Uploaded data are visible to all allowed users.<br>There is no private attachment.',
    'Upload Files' => 'If a file is too big to be uploaded onto this server, please use the HTA FTP server.',
);
This code is valid PHP code as far as I can see.
But this does not seem to please test_langs.php.
I think the "errors" are detected in the checkTokens function https://github.com/mantisbt/mantisbt/bl ... s.php#L259
Hence a few questions:
  1. Are those errors really important?
  2. Why is valid PHP code considered as faulty?
  3. What is the correct syntax for the MantisBT language files?
Thanks in advance for your answers.

Marc
Marc
---------------------------
Old Server: MantisBT 2.1.0, PHP 5.5.9, MySQL 5.7.16, Ubuntu Linux 14.04.3
New Server: MantisBT 2.26.1, PHP 8.1, MySQL 8.0, Ubuntu Linux 22.04.4
atrol
Site Admin
Posts: 8558
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Error messages within admin/test_langs.php#plugins

Post by atrol »

Looks like nobody used arrays until now to define messages.
Typically there is one variable per message.

Independent from that:
- using latest 2.26.2 is recommended
- I suspect your signature is outdated. If not, keep in mind that PHP 5.5.9 is no longer supported by MantisBT, see viewtopic.php?t=27295 and viewtopic.php?t=29799
Please use Search before posting and read the Manual
mcmo
Posts: 14
Joined: 18 Oct 2016, 07:04

Re: Error messages within admin/test_langs.php#plugins

Post by mcmo »

Good morning!

Thanks for your answer.
I am pleased to be a pioneer in this domain!
More seriously, when I did the plugin, it appeared to me that it would be easier to make the link between the field label and the field hint in a simple table.
I have the feeling that I can ignore these errors.
Should I report an issue in the bugtracker to get this fixed?

I just saw yesterday that 2.26.2 was out. We will upgrade to this version before switching to our new server running Ubuntu 22 LTS, MySQL 8.0, PHP 8.1.
Regarding my signature, I thought about changing it yesterday but wasn't sure because our production server is still using those older versions.
I just changed it.
Marc
---------------------------
Old Server: MantisBT 2.1.0, PHP 5.5.9, MySQL 5.7.16, Ubuntu Linux 14.04.3
New Server: MantisBT 2.26.1, PHP 8.1, MySQL 8.0, Ubuntu Linux 22.04.4
atrol
Site Admin
Posts: 8558
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Error messages within admin/test_langs.php#plugins

Post by atrol »

Even if the array syntax work for you, I wouldn't recommend it.
Our own translations are managed via translatewiki.net, see https://mantisbt.org/wiki/doku.php/mant ... tionshowto
I didn't ask them, but I am pretty sure that their tools to convert our format to their internal format and push it back in our format don't support this syntax.
The tools were written before I started to contribute to MantisBT.

Feel free to create a bug repoprt for that.
Not sure if someone from the core team will start working on a fix, as this is very low priority for the product, maybe even WAD.
If it's important for you, you could send us a pull request with a fix via GitHub.
Please use Search before posting and read the Manual
mcmo
Posts: 14
Joined: 18 Oct 2016, 07:04

Re: Error messages within admin/test_langs.php#plugins

Post by mcmo »

Thanks for your answer.

I understand now the full picture.
Hence if I want to get rid of those errors in admin/test_langs.php#plugins then I need to fix my plugins.
I won't enter a bug report as there is nothing to fix in the code.
The documentation might need some improvement in that respect for the next ones to avoid doing what I have done.
I will see if I can get something done on my own that would reduce the work needed on your side.

Last question: What does "WAD" mean? I could not find any sensible translation so far.
as this is very low priority for the product, maybe even WAD.
atrol
Site Admin
Posts: 8558
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Error messages within admin/test_langs.php#plugins

Post by atrol »

WAD = Works as designed
Please use Search before posting and read the Manual
Post Reply