flyspray / flyspray

Flyspray Bug Tracking System
GNU Lesser General Public License v2.1
376 stars 169 forks source link

Error output shown instead of comment (php8+, dokuwiki wikilinks) #874

Open OS4 opened 5 months ago

OS4 commented 5 months ago

The following is shown where a comment should be showing

Warning: Undefined array key 1 in /var/www/flyspray/plugins/dokuwiki/inc/parser/xhtml.php on line 972 Warning: Undefined array key "datadir" in /var/www/flyspray/plugins/dokuwiki/inc/pageutils.php on line 167 Warning: Undefined array key "autoplural" in /var/www/flyspray/plugins/dokuwiki/inc/pageutils.php on line 365 Warning: Undefined array key 1 in /var/www/flyspray/plugins/dokuwiki/inc/parser/xhtml.php on line 508 Warning: Undefined array key "userewrite" in /var/www/flyspray/plugins/dokuwiki/inc/common.php on line 288 Warning: Undefined array key "userewrite" in /var/www/flyspray/plugins/dokuwiki/inc/common.php on line 291 Unhandled exception: Undefined constant "DOKU_SCRIPT" This should never happen, please inform Flyspray Developers.

I can see datadir being used, but never set anywhere, not sure what it should set to.

peterdd commented 4 months ago

I assume you use PHP >=8.0.0?

Could you please show the raw content of the comment, so I can reproduce the problem? (What user inputs into text field with dokuwiki syntax)

Which PHP version?

peterdd commented 4 months ago

And the Flyspray version too. please.

OS4 commented 4 months ago

Hi,

I made some code changes to work around the issue. They're in Git, but I cannot push them up. The files are

flyspray/plugins/dokuwiki/inc/parser/xhtml.php

Lines 505 - 511 }

//keep hash anchor // list($id,$hash) = explode('#',$id,2); list($id) = explode('#',$id,2); // $hash has not be defined, prevents comment from appearing and PHP warnings

//prepare for formating $link['target'] = $conf['target']['wiki'];

Lines 530 - 536 }

//keep hash // if($hash) $link['url'].='#'.$hash; // $hash has not be defined, prevents comment from appearing and PHP warnings

//output formatted if($returnonly){

Lines 970 - 978 global $conf;

//if there is a hash we use the ancor name only // list($name,$hash) = explode('#',$name,2); // $hash has not be defined, prevents comment from appearing and PHP warnings // if($hash) return $hash; // $hash has not be defined, prevents comment from appearing and PHP warnings list($name) = explode('#',$name,2);

//trim colons of a namespace link $name = rtrim($name,':');

and in flyspray/plugins/dokuwiki/conf/local.php I added to the end of the file $conf['typography'] = 0; $conf['camelcase'] = 0; $conf['savedir'] = './data'; # just to silence unset warning $conf['datadir'] = './data'; # just to silence undefined warning $conf['lockdir'] = $conf['savedir']; # just to silence unset warning $conf['autoplural'] = 0; # just to silence undefined warning $conf['userewrite'] = 0; # just to silence undefined warning define('DOKU_SCRIPT','doku.php'); # just to silence undefined constant warning

Without this any new comments would result in [image: image.png] After the above code modifications the comments are displayed, so they are being stored, just not rendered.

Hope this helps

On Fri, 19 Apr 2024 at 16:07, peterdd @.***> wrote:

And the Flyspray version too. please.

— Reply to this email directly, view it on GitHub https://github.com/flyspray/flyspray/issues/874#issuecomment-2066773581, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5QUPJEE45GJXLVYE7CNXTY6EXLBAVCNFSM6AAAAABFXDVA4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRWG43TGNJYGE . You are receiving this because you authored the thread.Message ID: @.***>

peterdd commented 4 months ago

Thx, you can fork Flyspray master branch, so I see can see changes at https://github.com/flyspray/flyspray/network

Ideally then do a pull request. :-)

I see similiar warnings with PHP8+ in task comments if a what 'looks-like-a-Flyspray-task-link' is detected, but when that task actually does not exists:

comment text

nonexistent FS#123456 or bug 123456
OS4 commented 4 months ago

Forked, committed and pushed :-)

On Fri, 19 Apr 2024 at 17:29, peterdd @.***> wrote:

Thx, you can fork Flyspray master branch, so I see can see changes at https://github.com/flyspray/flyspray/network

Ideally then do a pull request. :-)

I see similiar warnings with PHP8+ in task comments if a what 'looks-like-a-Flyspray-task-link' is detected, but when that task actually does not exists:

comment text

nonexistent FS#123456 or bug 123456

— Reply to this email directly, view it on GitHub https://github.com/flyspray/flyspray/issues/874#issuecomment-2066909463, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5QUPKT65CGEG4GDOS2TV3Y6FA7DAVCNFSM6AAAAABFXDVA4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRWHEYDSNBWGM . You are receiving this because you authored the thread.Message ID: @.***>

Neustradamus commented 3 days ago

@peterdd: Have you seen the latest @OS4 comment?

Linked to:

peterdd commented 3 days ago

@OS4 Could you please give an example of a Flyspray task raw comment or task description that triggers the warnings?

I did #917 that handles https://github.com/flyspray/flyspray/issues/874#issuecomment-2066909463 but need example for your warnings. Your image link of https://github.com/flyspray/flyspray/issues/874#issuecomment-2066857451 is not seen anywhere..

peterdd commented 3 days ago

another pattern detected: \\\abc\def is now fixed, but I need to know your string @OS4

OS4 commented 3 days ago

Sorry for the late response. There was no particular string. The warnings would simply appear, seemingly at random, in the thread of comments. It was probably just a single character, possibly a minus sign. I can revert the changes, look at a few tickets, reapply my fixes and see what the offending string was. Won't be today I'm afraid.