#597 Some brackets links on 2 lines cause the parser to crash

Wiki_syntax
closed
7
2012-10-11
2008-02-28
No

foo [ foo foo
foo | bar]
bar

causes a fatal error.

This errors occurs in the following help page:
Help%2FCalendarListPlugin (version 1.2)

Discussion

  • Reini Urban

    Reini Urban - 2008-03-17

    Logged In: YES
    user_id=13755
    Originator: NO

    I debugged this problem and I hope I have fixed it in lib/InlineParser.php:333

    // Bug#1904088: \n inside [] will lead to errors
    preg_match('/(\#?) \[\s* (?: (.*?) \s* (?<!' . ESCAPE_CHAR . ')(\|) )? \s* (.+?) \s*\]/x',
           str_replace("\n", "", $bracketlink), $matches);
    
     
  • Marc-Etienne Vargenau

    Logged In: YES
    user_id=1118700
    Originator: YES

    Hello,

    Thank you for correcting this.

    May I suggest:

    str_replace("\n", " ", $bracketlink), $matches);

    instead of

    str_replace("\n", "", $bracketlink), $matches);

    i.e. replace the newline with a space instead of nothing.

    With your code, you get "foofoo", I would expect "foo foo"

    Best regards,

    Marc-Etienne

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks