Re: [pmwiki-users] Fix blogit for use with PHP 5.5
On Sun, Nov 02, 2014 at 12:08:30PM +0100, Tiger!P wrote: > On Thu, Oct 30, 2014 at 05:41:42PM -0400, DaveG wrote: > > On 10/30/2014 1:58 PM, Tiger!P wrote: > > >>>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. Sorry for the late reply, but I needed some time to setup an old system. I checked this and the following text is indeed new. I compared a debian squeeze (PHP 5.3.3) and a debian jessie (PHP 5.6.2) installation. > > >>>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:) > > > > > >This problem still exists. The information above is valid for PHP 5.6.2. I can provide screenshots of the issue when needed. Please let me know where I should share the two screenshots (+/- 140 KB). > > >And now the /Blog/Main page does not have any blog posts anymore. Also > > >the list of recently written is empty. > > >But the Categories contains a list of tags and when I select a tag, I > > >see a link to the blogpost which has that tag. This is not valid when using a clean pmwiki (2.2.69) install with only blogit as cookbook item. > > > > > >So I think something is not quite right yet. > > > > > >Hopefully DaveG can give some advice. > > I suspect this error is not related to PHP5. I've applied your patches, and > > the test site seems to work (ref http://wiki.solidgone.org/BlogIt/Main). I'm not able to test the error situation above, because you have to be logged-in. to be able to create a new entry. Tiger!P -- A random quote: Ruimte bewaken heeft geen zin, ze stelen het en je weet niet eens dat ze het gestolen hebben. ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
On Tue, Nov 04, 2014 at 08:43:30AM +1300, John Rankin wrote: > > > On Thu, Oct 30, 2014 at 05:41:42PM -0400, DaveG wrote: > >> > >> > >> On 10/30/2014 1:58 PM, Tiger!P wrote: > >> Quick questions: > >> 1. Tiger!P: With your patch file, why are you making the change to > >> $PageTextVarPatterns, from #blogit_(\w[_-\w]*) to #blogit_(\w[_\w-]*)? > > > > To get rid of the warning "PHP Warning: preg_match_all(): Compilation > > failed: invalid range in character class at offset 20 in > > /home/tigerp/www/pmwiki-2.2.62/pmwiki.php on line 797" > > > I think it should read (\w[-_\w]*) It might not be completly clear, but I change the original code "(\w[_-\w]*)" to "(\w[_\w-]*)". So I put the - at the end. > Otherwise, PHP interprets _-\w as "from _ to \w" which is an invalid > range. To exclude - it has to be first in the [ ... ] set. I understand, but I don't think it must be the first but can also be the last, or be escaped by \ which will result in "(\w[_\-\w]*)". At least the warning was gone when I changed the line. Thank you for your information on this matter. Tiger!P -- A random quote: Don't harm yourself if you don't want to. ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
> On Thu, Oct 30, 2014 at 05:41:42PM -0400, DaveG wrote: >> >> >> On 10/30/2014 1:58 PM, Tiger!P wrote: >> Quick questions: >> 1. Tiger!P: With your patch file, why are you making the change to >> $PageTextVarPatterns, from #blogit_(\w[_-\w]*) to #blogit_(\w[_\w-]*)? > > To get rid of the warning "PHP Warning: preg_match_all(): Compilation > failed: invalid range in character class at offset 20 in > /home/tigerp/www/pmwiki-2.2.62/pmwiki.php on line 797" > I think it should read (\w[-_\w]*) Otherwise, PHP interprets _-\w as "from _ to \w" which is an invalid range. To exclude - it has to be first in the [ ... ] set. JR -- John Rankin ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
On Thu, Oct 30, 2014 at 05:41:42PM -0400, DaveG wrote: > > > On 10/30/2014 1:58 PM, Tiger!P wrote: > >>>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:) > > > >This problem still exists. > >And now the /Blog/Main page does not have any blog posts anymore. Also > >the list of recently written is empty. > >But the Categories contains a list of tags and when I select a tag, I > >see a link to the blogpost which has that tag. > > > >So I think something is not quite right yet. > > > >Hopefully DaveG can give some advice. > I suspect this error is not related to PHP5. I've applied your patches, and > the test site seems to work (ref http://wiki.solidgone.org/BlogIt/Main). > > For others testing this out, ensure you have updated to the latest version > of PMWiki, load the new version of PmForms, ensure your skin is PHP5 > compatible, and ensure other cookbooks you include are also compatible. I use the Enlighten skin [1] and I don't see any warnings in the webserver log. I will see if I can install the pmwiki directory on a system with an older php version. > Quick questions: > 1. Tiger!P: With your patch file, why are you making the change to > $PageTextVarPatterns, from #blogit_(\w[_-\w]*) to #blogit_(\w[_\w-]*)? To get rid of the warning "PHP Warning: preg_match_all(): Compilation failed: invalid range in character class at offset 20 in /home/tigerp/www/pmwiki-2.2.62/pmwiki.php on line 797" [1] http://www.pmwiki.org/wiki/Skins/Enlighten Tiger!P -- A random quote: A man is a maze of brambles in darkness and even does not know the way. ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
On 11/1/2014 3:07 PM, Petko Yotov wrote: I went ahead and used anon functions with Markup, just to make things internally consistent. This is fine as long as your recipe is intended to only work with PHP 5.3 and more recent: http://php.net/manual/en/functions.anonymous.php Ah, I was not aware of that. I'll update the wiki to make that clearer. In which case, I'll take the same approach as PmForm, and test for Markup_e, and use that, otherwise use the original behavior. 3. All: Any suggestions for this: $bodyTags = (preg_match_all('/\[\[\!(.*?)\]\]/e', $body, $match) ?$match[1] :array()); To be honest I'm not entirely sure why the e modifier is used there, but assuming it's needed, do we have Pm helper functions for preg_match_all? The "e" part should not be needed - it is ignored by preg_match_all(). Thanks. Also, thanks to John, and Tiger!P -- your input is appreciated. ~ ~ David ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
On 30.10.2014 22:41, DaveG wrote: 2. All: Is there a preference to using Markup_e over Markup? No, simply Markup_e() should be easier (less code) in some cases which I assumed will be frequent. I went ahead and used anon functions with Markup, just to make things internally consistent. This is fine as long as your recipe is intended to only work with PHP 5.3 and more recent: http://php.net/manual/en/functions.anonymous.php 3. All: Any suggestions for this: $bodyTags = (preg_match_all('/\[\[\!(.*?)\]\]/e', $body, $match) ?$match[1] :array()); To be honest I'm not entirely sure why the e modifier is used there, but assuming it's needed, do we have Pm helper functions for preg_match_all? The "e" part should not be needed - it is ignored by preg_match_all(). Petko ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
On 10/30/2014 1:58 PM, Tiger!P wrote: 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:) This problem still exists. And now the /Blog/Main page does not have any blog posts anymore. Also the list of recently written is empty. But the Categories contains a list of tags and when I select a tag, I see a link to the blogpost which has that tag. So I think something is not quite right yet. Hopefully DaveG can give some advice. I suspect this error is not related to PHP5. I've applied your patches, and the test site seems to work (ref http://wiki.solidgone.org/BlogIt/Main). For others testing this out, ensure you have updated to the latest version of PMWiki, load the new version of PmForms, ensure your skin is PHP5 compatible, and ensure other cookbooks you include are also compatible. Quick questions: 1. Tiger!P: With your patch file, why are you making the change to $PageTextVarPatterns, from #blogit_(\w[_-\w]*) to #blogit_(\w[_\w-]*)? 2. All: Is there a preference to using Markup_e over Markup? I went ahead and used anon functions with Markup, just to make things internally consistent. 3. All: Any suggestions for this: $bodyTags = (preg_match_all('/\[\[\!(.*?)\]\]/e', $body, $match) ?$match[1] :array()); To be honest I'm not entirely sure why the e modifier is used there, but assuming it's needed, do we have Pm helper functions for preg_match_all? ~ ~ David ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
I'm looking into PHP5 compatibility right now. Not progressing far, as I need to research exactly what I'm remediating, but hopefully have some progress soonish. ~ ~ David On 10/30/2014 1:58 PM, Tiger!P wrote: On Thu, Oct 30, 2014 at 02:17:58PM +1300, John Rankin wrote: On Mon, Oct 27, 2014 at 10:22:17AM +1300, John Rankin wrote: Hello John, [cut how to fix the Markup('blogit' line] 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:) This problem still exists. And now the /Blog/Main page does not have any blog posts anymore. Also the list of recently written is empty. But the Categories contains a list of tags and when I select a tag, I see a link to the blogpost which has that tag. So I think something is not quite right yet. Hopefully DaveG can give some advice. 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. It looks like there are a number of instances of the /e modifier which need to be changed. In $bi_MakePageNamePatterns, it needs to remove the e, then use and PCCF("return utf8toupper(\$m[1]);") and PCCF("return strtoupper(\$m[1]);") This solved the issue of the deprecated warnings in the log :-) Thank you for that. Then all 3 calls to Markup need to be updated, in the same way as the 'blogit' rule. I already did that before. Attached is a patch for blogit.php with the changes I made sofar. Tiger!P ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
On Thu, Oct 30, 2014 at 02:17:58PM +1300, John Rankin wrote: > > > On Mon, Oct 27, 2014 at 10:22:17AM +1300, John Rankin wrote: > > > > Hello John, > > [cut how to fix the Markup('blogit' line] > > 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:) This problem still exists. And now the /Blog/Main page does not have any blog posts anymore. Also the list of recently written is empty. But the Categories contains a list of tags and when I select a tag, I see a link to the blogpost which has that tag. So I think something is not quite right yet. Hopefully DaveG can give some advice. > > 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. > > It looks like there are a number of instances of the /e modifier which > need to be changed. > > In $bi_MakePageNamePatterns, it needs to remove the e, then use and > PCCF("return utf8toupper(\$m[1]);") and PCCF("return strtoupper(\$m[1]);") This solved the issue of the deprecated warnings in the log :-) Thank you for that. > Then all 3 calls to Markup need to be updated, in the same way as the > 'blogit' rule. I already did that before. Attached is a patch for blogit.php with the changes I made sofar. Tiger!P -- A random quote: Een theemuts is niet alleen goed voor de theepot. --- blogit.php.orig.201410022014-10-02 17:04:04.951513050 +0200 +++ blogit.php 2014-10-30 18:56:39.137676955 +0100 @@ -79,8 +79,8 @@ "/[^". $PageNameChars. "]+/" => $bi_TitleSeparator, #convert everything else to hyphen "/(^\\" .$bi_TitleSeparator ."+)|(\\" .$bi_TitleSeparator ."+\$)/" => '', #trim hyphens front and back "/\\" .$bi_TitleSeparator ."{2,}/" => $bi_TitleSeparator, #trim duplicate hyphens - ($Charset=='UTF-8' ?"/^([\\xc0-\\xdf].)/e" :'//') => ($Charset=='UTF-8' ?"utf8toupper('$1')" :''), #uppercase first letter - "/^([a-z])/e" => "strtoupper('$1')" + ($Charset=='UTF-8' ?"/^([\\xc0-\\xdf].)/" :'//') => ($Charset=='UTF-8' ? PCCF("return utf8toupper(\$m[1]);") :''), #uppercase first letter + "/^([a-z])/" => PCCF("return strtoupper(\$m[1]);") )); SDVA($bi_FixPageTitlePatterns, array( '/[.\\/#]/' => '' #remove dots, forward and backslashes in page titles as MakePageName returns '' when these characters are present @@ -140,7 +140,7 @@ $bi_OriginalFn['AuthFunction']=$AuthFunction; #must occur before calling bi_Auth() $AuthFunction = 'bi_BlogItAuth'; #TODO: Use $AuthUserFunctions instead? # Need to save entrybody in an alternate format to prevent (:...:) markup confusing the end of the variable definition. -$PageTextVarPatterns['[[#anchor]]'] = '/(\[\[#blogit_(\w[_-\w]*)\]\](?: *\n)?)(.*?)(\[\[#blogit_\2end\]\])/s'; #[1] +$PageTextVarPatterns['[[#anchor]]'] = '/(\[\[#blogit_(\w[_\w-]*)\]\](?: *\n)?)(.*?)(\[\[#blogit_\2end\]\])/s'; #[1] $bi_Pagename = ResolvePageName($pagename); #undo clean urls (replace / with .) to make pagename checks easier if ($bi_Pagename == $bi_Pages['blog_list'])$FmtPV['$bi_BlogId']='"' .bi_Clean('word', $_GET['blogid']) .'"'; @@ -236,14 +236,20 @@ # # - Markup -Markup('blogit', 'fulltext', '/\(:blogit (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/esi', - "blogitMU_$1(PSS('$2'), PSS('$3'))"); -Markup('blogit-skin', 'fulltext', '/\(:blogit-skin '. +Markup('blogit', 'fulltext', '/\(:blogit + (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si', +function ($m) { +$func = 'blogitMU_'.$m[1]; +return $func($m[2], $m[3]); +} + ); + +Markup_e('blogit-skin', 'fulltext', '/\(:blogit-skin '. '(date|intro|author|tags|edit|newentry|delete|commentcount|date|commentauthor|commentapprove|commentdelete|commentedit|commentreply|commentblock|commenttext|commentid)'. - '\s?(.*?):\)(.*?)\(:blogit-skinend:\)/esi', - "blogitSkinMU('$1', PSS('$2'), PSS('$3'))"); -Markup('includesection', '>if', '/\(:includesection\s+(\S.*?):\)/ei', - "PRR(bi_includeSection(\$GLOBALS['bi_Pagename'], PSS('$1 '.\$GLOBALS['bi_TemplateList'])))"); + '\s?(.*?):\)(.*?)\(:blogit-skinend:\)/si', + "blogitSkinMU(\$m[1], PSS(\$m[2]), PSS(\$m[3]))"); +Markup_e('includesection', '>if', '/\(:in
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
> 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: >> >... >> >> 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. It looks like there are a number of instances of the /e modifier which need to be changed. In $bi_MakePageNamePatterns, it needs to remove the e, then use and PCCF("return utf8toupper(\$m[1]);") and PCCF("return strtoupper(\$m[1]);") Then all 3 calls to Markup need to be updated, in the same way as the 'blogit' rule. Those were all I could see with a search through the code. Hope this makes sense. Good luck! JR > > Tiger!P > -- > A random quote: > Alles hat ein ende, nur die wurst hat zwei. > > ___ > pmwiki-users mailing list > pmwiki-users@pmichaud.com > http://www.pmichaud.com/mailman/listinfo/pmwiki-users > -- John Rankin ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
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. ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
> 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 ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
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). Tiger!P -- A random quote: Je hoeft niet veel te hebben om gelukkig te zijn. --- blogit.php.orig.201410022014-10-02 17:04:04.951513050 +0200 +++ blogit.php 2014-10-24 18:25:28.965148636 +0200 @@ -140,7 +140,7 @@ $bi_OriginalFn['AuthFunction']=$AuthFunction; #must occur before calling bi_Auth() $AuthFunction = 'bi_BlogItAuth'; #TODO: Use $AuthUserFunctions instead? # Need to save entrybody in an alternate format to prevent (:...:) markup confusing the end of the variable definition. -$PageTextVarPatterns['[[#anchor]]'] = '/(\[\[#blogit_(\w[_-\w]*)\]\](?: *\n)?)(.*?)(\[\[#blogit_\2end\]\])/s'; #[1] +$PageTextVarPatterns['[[#anchor]]'] = '/(\[\[#blogit_(\w[_\w-]*)\]\](?: *\n)?)(.*?)(\[\[#blogit_\2end\]\])/s'; #[1] $bi_Pagename = ResolvePageName($pagename); #undo clean urls (replace / with .) to make pagename checks easier if ($bi_Pagename == $bi_Pages['blog_list'])$FmtPV['$bi_BlogId']='"' .bi_Clean('word', $_GET['blogid']) .'"'; @@ -236,14 +236,14 @@ # # - Markup -Markup('blogit', 'fulltext', '/\(:blogit (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/esi', - "blogitMU_$1(PSS('$2'), PSS('$3'))"); -Markup('blogit-skin', 'fulltext', '/\(:blogit-skin '. +Markup_e('blogit', 'fulltext', '/\(:blogit (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si', + "blogitMU_"."\$m[1](PSS('\$m[2]'), PSS('\$m[3]'))"); +Markup_e('blogit-skin', 'fulltext', '/\(:blogit-skin '. '(date|intro|author|tags|edit|newentry|delete|commentcount|date|commentauthor|commentapprove|commentdelete|commentedit|commentreply|commentblock|commenttext|commentid)'. - '\s?(.*?):\)(.*?)\(:blogit-skinend:\)/esi', - "blogitSkinMU('$1', PSS('$2'), PSS('$3'))"); -Markup('includesection', '>if', '/\(:includesection\s+(\S.*?):\)/ei', - "PRR(bi_includeSection(\$GLOBALS['bi_Pagename'], PSS('$1 '.\$GLOBALS['bi_TemplateList'])))"); + '\s?(.*?):\)(.*?)\(:blogit-skinend:\)/si', + "blogitSkinMU(\$m[1], PSS(\$m[2]), PSS(\$m[3]))"); +Markup_e('includesection', '>if', '/\(:includesection\s+(\S.*?):\)/i', + "PRR(bi_includeSection(\$GLOBALS['bi_Pagename'], PSS(\$m[1].' '.\$GLOBALS['bi_TemplateList'])))"); $SaveAttrPatterns['/\\(:includesection\\s.*?:\\)/i'] = ' '; #prevents include sections becoming part of page targets list if (IsEnabled($EnableGUIButtons) && $FmtPV['$bi_Mode']!='ajax'){ if ($action=='bi_be' || $action=='bi_ne' || ($action=='pmform' && $_REQUEST['target']=='blogit-entry')) ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Fix blogit for use with PHP 5.5
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. ~ ~ David ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users