#1925 parsing of nested plugins in some cases causes php timeout

BRANCH-1-9_(CVS)
closed-fixed
nobody
7
2005-04-05
2005-03-29
luciash d' being
No

example:
while this code works with no problem

<pre>
{FANCYTABLE(head=>A~|~B~|~C~|~D~|~E~|~F)}
a1 ~|~ b1 ~|~ c1 ~|~ d1 ~|~ e1 ~|~ Some content in
the cell f1. Some content in the cell f1. Some content in
the cell f1.
a2 ~|~ b2 ~|~ c2 ~|~ d2 ~|~ e2 ~|~
{CENTER()}Content to be forced to center in the
cell{CENTER}
a3 ~|~ b3 ~|~ c3 ~|~ d3 ~|~ e3 ~|~ Some content in
the cell f3.
{FANCYTABLE}
</pre>

this one already results in php timeout with blank page:

<pre>
{CENTER()}
{FANCYTABLE(head=>A~|~B~|~C~|~D~|~E~|~F)}
a1 ~|~ b1 ~|~ c1 ~|~ d1 ~|~ e1 ~|~ Some content in
the cell f1. Some content in the cell f1. Some content in
the cell f1.
a2 ~|~ b2 ~|~ c2 ~|~ d2 ~|~ e2 ~|~
{CENTER()}Content to be forced to center in the
cell{CENTER}
a3 ~|~ b3 ~|~ c3 ~|~ d3 ~|~ e3 ~|~ Some content in
the cell f3.
{FANCYTABLE}
{CENTER}
</pre>

this bug seems appeared on BRANCH-1-9 only. it worked
before (toggg tested with 1.8.5)

Discussion

1 2 > >> (Page 1 of 2)
  • Logged In: YES
    user_id=750082

    do not include the <pre> tags if you want to test, it was
    meant for this report only but didn't worked :-(

     
  • Oliver Hertel
    Oliver Hertel
    2005-03-29

    • assigned_to: nobody --> ohertel
     
  • Logged In: YES
    user_id=379264

    Hi olivier,
    I was working with luci, didn't see you took it allready.
    The nested identical plugins were no more considered.
    So that should do it.
    Bye
    *** /home/bertrand/tiki/cvs/1.9/tikiwiki/lib/tikilib.php
    2005-03-22 07:12:56.000000000 +0100
    --- ./tikilib.php 2005-03-29 18:50:12.953441688 +0200
    ***************
    *** 3876,3883 ****
    $plugin_end = $plugin_ends[0];
    $pos_end = strpos($data, $plugin_end, $pos);
    // where plugin data ends
    } else {
    ! $plugin_end = '{' . $plugin . '}';
    ! $pos_end = strpos($data, $plugin_end,
    $pos_middle); // where plugin data ends
    }

    /*
    --- 3876,3896 ----
    $plugin_end = $plugin_ends[0];
    $pos_end = strpos($data, $plugin_end, $pos);
    // where plugin data ends
    } else {
    ! $plugin_end = '{' . $plugin;
    ! $count=1;
    ! while($count) { // where plugin data ends
    ! $pos_end = strpos($data, $plugin_end,
    $pos_middle);
    ! if ($pos_end === false) {
    ! $pos_end = strlen($data);
    ! break;
    ! }
    ! $pos_middle = $pos_end+strlen($plugin_end);
    ! if ($data{$pos_middle} == '}')
    ! $count--;
    ! elseif ($data{$pos_middle} == '(')
    ! $count++;
    ! }
    ! $plugin_end .= '}';
    }

    /*

     
    • status: open --> closed
     
    • status: closed --> open
     
  • Logged In: YES
    user_id=379264

    Oliver,
    I forgot to mention, this one does not loop but gives
    usefull information:
    {CENTER()}{CENTER()}
    Content to be forced to center in the cell
    {CENTER}{CENTER}
    +
    bertrand

     
    • status: open --> closed
     
    • status: closed --> open
     
    • assigned_to: ohertel --> luciash
     
1 2 > >> (Page 1 of 2)