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

John Rankin john.rankin at affinity.co.nz
Sun Oct 26 16:22:17 CDT 2014


> 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
JR
-- 
John Rankin




More information about the pmwiki-users mailing list