[pmwiki-users] Problems updating to latest PmWiki version (2.2.61)

Petko Yotov 5ko at 5ko.fr
Thu Feb 20 14:12:36 CST 2014


The new conversion functions, like the new MarkupToHTML() function, check if  
the replacement pattern string is a callable function: if it is, it calls it.

The PHP function _() is an alias of gettext(), so it gets called.

Unfortunately I don't see a good way to prevent this.

But there is a workaround:

   '/ /' => PCCF('return "_";'),  # convert spaces to underscores

Petko

Hans B writes:
> I am trying to update from an older version (2.2.35).
> I get multiple warning errors like this:
>
> Warning: _() expects parameter 1 to be string, array given  
> in ......./pmwiki.php on line 467
>
> I see the error occurs in calls to function PPRA.
>
> I narrowed down what causes the warnings.
> It appears it stems from defining  $MakePageNamePatterns in config.php.
>
> I have been using this successfully:
>
> $MakePageNamePatterns = array(
>     "/'/" => '',                           # strip single-quotes
>     "/[^$PageNameChars]+/" => ' ',         # convert everything else to space
>     '/((^|[^-\\w])\\w)/e' => "strtoupper('$1')", # make first letters upper  
> case
>     '/ /' => '_'
> );  # convert spaces to underscores
>
> I changed it to this, to get rid of the /e modifier in the third item, as  
> required for
> PHP 5.5 compliance:
>
> $MakePageNamePatterns = array(
>     "/'/" => '',                           # strip single-quotes
>     "/[^$PageNameChars]+/" => ' ',         # convert everything else to space
>     '/((^|[^-\\w])\\w)/' => PCCF("return strtoupper(\$m[1]);"), # make first  
> letters upper case
>     '/ /' => '_',  # convert spaces to underscores
> );
>
> but it appears that the last array entry, which should convert spaces
> to underscores, is bringing up the warnings.
> How can this be solved? I have no idea what is going on there.
>
> Note: I use some wikis where page names have underscores separating the
> words, so not just standard CamelCase page names, but names like
> Home_Page in the URL.




More information about the pmwiki-users mailing list