infojunkie / MantisBT-Slack

Slack integration for Mantis bug tracker
GNU General Public License v2.0
48 stars 38 forks source link

'Use of undefined constant text - assumed 'text' in '/var/www/html/plugins/Slack/Slack.php' line 196 #57

Closed TBG-FR closed 2 years ago

TBG-FR commented 3 years ago

When trying to add a note on a bug, I get this message 'Use of undefined constant text - assumed 'text' (this will throw an Error in a future version of PHP)' in '/var/www/html/plugins/Slack/Slack.php' line 196

So, the culprit seem to be this piece of code

    function get_text_attachment($text) {
        $attachment = array('color' => '#3AA3E3', 'mrkdwn_in' => array('pretext', 'text', 'fields'));
        $attachment['fallback'] = text . "\n";
        $attachment['text'] = $text;
        return $attachment;
    }

Is there a reason for having text instead of $text here, or is this just a little bug ? What is strange is that I never had this error message on another MantisBT install (the only difference seem to be PHP version...)

infojunkie commented 3 years ago

Thanks, yes, looks like a bug.

TBG-FR commented 3 years ago

Alright, I'll make a small PR then !

infojunkie commented 2 years ago

Fixed as per https://github.com/infojunkie/MantisBT-Slack/commit/8efa4d8df039c0f13429e8acaec6b9a95fb53344