[pmwiki-users] Fix blogit for use with PHP 5.5

Tiger!P pmwiki-tigerp at tigerp.net
Tue Oct 28 09:33:51 CDT 2014


On Mon, Oct 27, 2014 at 10:22:17AM +1300, John Rankin wrote:

Hello John,

> > On Thu, Oct 23, 2014 at 06:51:59PM -0400, DaveG wrote:
> >
> > Hello David,
> >
> >> On 10/23/2014 3:24 PM, Tiger!P wrote:
> >> >The original code line is (line 239):
> >> >
> >> >Markup('blogit', 'fulltext', '/\(:blogit
> >> (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/esi',
> >> >  "blogitMU_$1(PSS('$2'), PSS('$3'))");
> >> >
> >> >I replaced it with the following:
> >> >
> >> >Markup_e('blogit', 'fulltext', '/\(:blogit
> >> (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si',
> >> >           "blogitMU_\$m[1](PSS(\$m[2]), PSS(\$m[3]))");
> >> >
> >> >But this results in the following message in apache's error.log:
> >> >PHP Parse error:  syntax error, unexpected '$m' (T_VARIABLE) in
> >> >/home/tigerp/www/pmwiki-2.2.62/pmwiki.php(458) : runtime-created
> >> >function on line 1
> >> I have not yet looked into updating blogit to work with php5.5, but
> >> purely
> >> based on reading ref [1], and purely based on syntax, you may need to
> >> simply
> >> quote the $m parameters in the $replace part of the markup:
> >>
> >> Markup_e('blogit', 'fulltext', '/\(:blogit
> >> (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si',
> >>           "blogitMU_\$m[1](PSS('\$m[2]'), PSS('\$m[3]'))");
> >>
> >> Let me know how that works. If you could send me the changes you made,
> >> I'll
> >> update BlogIt.
> >
> > I tried this, but it gave the same error message in the log.
> > Attached you will find a patch for blogit.php based on version 1.7.0
> > (2011-07-04) and it is using the suggested fix above (which does not
> > work).
> 
> Try the following:
> 
> Markup('blogit', 'fulltext', '/\(:blogit
>  (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si',
>         function ($m) {
>             $func = 'blogitMU_'.$m[1];
>             return $func($m[2], $m[3]);
>         }
>   );
> 
> Hope this helps

This does not result in the error message, but when I go to the new blog
page (/Site/BlogIt-Admin?action=bi_ne ) some blogit codes are displayed
on the page. I don't know if this was the case before PHP5.5, but don't
think so.

Blog Title: (:blogit list "$:entrytype":)bi_PageType/Type:
(:blogitend:)(:blogit list "$:blogid":)bi_BlogList/BlogID: (:blogitend:)
Tags: (:blogit list "$:entrystatus":)bi_StatusType/Status:
(:blogitend:)(:blogit list "$:entrycomments":)bi_CommentType/Comments:
(:blogitend:)

When I save the new blog entry, I get still some deprecated messages:
PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use
preg_replace_callback instead in
/home/tigerp/www/pmwiki-2.2.62/pmwiki.php on line 471

So I think a little bit more needs to be done.

Tiger!P
-- 
A random quote:
Alles hat ein ende, nur die wurst hat zwei.



More information about the pmwiki-users mailing list