[pmwiki-devel] markupexpr.php error notices

Hans design5 at softflow.co.uk
Sun Dec 9 16:40:24 CST 2007


Sunday, December 9, 2007, 9:11:40 PM, Dominique wrote:

> Could you please give the definition of the MarkupExpr function which
> is triggering this error?

Oh i see it is mostly my own definition. But I am not quite sure.
Here is the definition:

# {(catlist PAGENAME SEPARATOR)} (arguments optional)
$MarkupExpr['catlist'] = 'CategoryList($pagename, @$args[0], @$args[1])';

function CategoryList($pn, $arg='', $sep=',') {
        global $CategoryGroup;
        if(!$arg=='') $pn = MakePageName($pn, $arg);
        if($sep==NULL) $sep = ",";
        $page = RetrieveAuthPage($pn, 'read', true);
        $pat = '/\\[\\[\\!(.*?)\\]\\]/';
        $text = preg_replace('/\\(:(.*?):\\)/' ,"", $page['text']);
        if(preg_match_all($pat, $text, $matches)) {
        foreach($matches[1] as $i=>$m)
                 $catlist[] = MakePageName($pn, $CategoryGroup.".".$m);
        return implode($sep, $catlist);
        }
}

I just added the @ to @args[0] , @args[1], thanks for the hint.
This cuts down the errors, but I still get some:

using {(catlist)} without arguments I get these errors:

Notice: Undefined offset: 3 in ...cookbook\markupexprplus.php on line 106

Notice: Undefined index: # in ...\cookbook\markupexprplus.php on line 119

and when I use {(catlist )}  (extra space added) I get

Notice: Undefined index: # in ...cookbook\markupexprplus.php on line 119

and when I use {(catlist '')} I get no errors.

Please tell me if I can improve the definition, or if the error comes
form the script. It seems that
    $x = $argp['#'];
in the script can be undefined.


Hans




More information about the pmwiki-devel mailing list