[pmwiki-users] Deprecated error after upgrade to version 2.3.11
After upgrqading pmwiki to vs. 2.3.11 i got the error *Deprecated*: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in */home2/godau/public_html/valentin/wiki/pmwiki.php* on line *75* My installed php Version is 8.2*. *I changed line 75 from $ChangeSummary = substr(preg_replace('/[\\x00-\\x1f]|=\\]/', '', stripmagic(@$_REQUEST['csum'])), 0, 100); to $ChangeSummary = stripmagic(@$_REQUEST['csum']); if (!is_null($ChangeSummary) && strlen($ChangeSummary) > 0) { $ChangeSummary = substr(preg_replace('/[\\x00-\\x1f]|=\\]/', '', $ChangeSummary), 0, 100); } and pmwiki ran without the deprecated warning. ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Using imagemap.php with php8.x
I've installed your version and it seems to work without problems. Thank You! jürgen Am Do., 23. Juni 2022 um 14:02 Uhr schrieb Petko Yotov <5...@5ko.fr>: > Thanks, I've updated the recipe on the cookbook: > >https://www.pmwiki.org/wiki/Cookbook/ImageMap > > The update is a little different from your suggestion, includes some > refactoring and improvements for links, and should work at least until > PHP 8.1. > > If you find any problems with the new recipe on existing PmWiki markup, > please let me know. > > Petko > > -- > If you upgrade : https://www.pmwiki.org/Upgrades > > > На 22/06/2022 15:02, Hans-Jürgen Godau написа: > > While using imagemap.php from the cookbook I had to change the code > > because of Warnings/Errors shown by php: > > > > --- imagemap.php 2022-06-21 17:42:57.389642705 +0200 > > +++ imagemap.php.new 2022-06-22 13:47:31.360706020 +0200 > > @@ -49,17 +49,22 @@ > > Markup('area', 'directives', "/\\(:area (.*?)?\\s*?:\\)/", > > "MapArea"); > > function MapArea($m) { > > global $ScriptUrl, $EnablePathInfo, $EnableOnclickJavascripting; > > -$arg = PSS(ParseArgs($m[1])); > > -if (isset($arg['href'])) { > > +$out=""; > > +if (is_array($m) && array_key_exists(1,$m)) { > > + /* $arg = ParseArgs($m[1]); */ > > + $arg = ParseArgs(PSS($m[1])); > > + if (isset($arg['href'])) { > > $tgt = $arg['href']; > > if($EnablePathInfo) $LinkUrl = $ScriptUrl."/".$tgt; > > else $LinkUrl = $ScriptUrl."?n=".$tgt; > > -preg_match("/(http:)(.*?)/",$tgt,$m); > > -if($m[1]) $LinkUrl = $tgt; > > -preg_match("/(#)(.*?)/",$tgt,$m); > > -if($m[1]) $LinkUrl = $tgt; > > +if (preg_match("/(http:)(.*?)/",$tgt,$m)) { > > +if($m[1]) $LinkUrl = $tgt; > > + } > > +if (preg_match("/(#)(.*?)/",$tgt,$m)) { > > +if($m[1]) $LinkUrl = $tgt; > > + } > > } > > -$out = " > +$out .= " > if (isset($arg['shape'])) > > $out .= " shape='".$arg['shape']."'"; > > if (isset($arg['coords'])) > > @@ -77,5 +82,7 @@ > >if (isset($arg['onclick'])) > > $out .= " onclick='".$arg['onclick']."'"; } > > $out .= " />"; > > +} > > return Keep($out); > > + > > } > > > > Maybe you could adjust the imagemap.php code? > > > > Thanks, > > H.-Jürgen Godau > > ___ > > 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
[pmwiki-users] Using imagemap.php with php8.x
While using imagemap.php from the cookbook I had to change the code because of Warnings/Errors shown by php: --- imagemap.php 2022-06-21 17:42:57.389642705 +0200 +++ imagemap.php.new 2022-06-22 13:47:31.360706020 +0200 @@ -49,17 +49,22 @@ Markup('area', 'directives', "/\\(:area (.*?)?\\s*?:\\)/", "MapArea"); function MapArea($m) { global $ScriptUrl, $EnablePathInfo, $EnableOnclickJavascripting; -$arg = PSS(ParseArgs($m[1])); -if (isset($arg['href'])) { +$out=""; +if (is_array($m) && array_key_exists(1,$m)) { + /* $arg = ParseArgs($m[1]); */ + $arg = ParseArgs(PSS($m[1])); + if (isset($arg['href'])) { $tgt = $arg['href']; if($EnablePathInfo) $LinkUrl = $ScriptUrl."/".$tgt; else $LinkUrl = $ScriptUrl."?n=".$tgt; -preg_match("/(http:)(.*?)/",$tgt,$m); -if($m[1]) $LinkUrl = $tgt; -preg_match("/(#)(.*?)/",$tgt,$m); -if($m[1]) $LinkUrl = $tgt; +if (preg_match("/(http:)(.*?)/",$tgt,$m)) { +if($m[1]) $LinkUrl = $tgt; + } +if (preg_match("/(#)(.*?)/",$tgt,$m)) { +if($m[1]) $LinkUrl = $tgt; + } } -$out = "___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Undefined array key "title" in .../grouptitle.php - in PHP8
I just would try using the line *if (array:key:exists('title',$page) && $page['title']) { return $page['title'];* I think in php 8 a non existing key throws this Warning! Greetings, jürgen Am Sa., 19. Feb. 2022 um 11:28 Uhr schrieb Jean-Patrick Charrey < jpchar...@free.fr>: > Hi > > I have been testing the latest Pmwiki 2.3.2 on PHP8.0 I have the > following warning message: > > *Warning*: Undefined array key "title" in *.../cookbook/grouptitle.php* on > line *39* > > I have been to reproduce this bug on a plain setup, no other cookbooks, > default PMwiki skin. > I don't have this message in PHP7.4 > > Line 39 in grouptitle.php has the following code > > *if ($page['title']) { return $page['title'];* > > I guessing a sintax update is needed, but not sure which one. I realize > this Cookbook is perhaps not the most used, but I would appreciate some > help to fix this issue. > Jean-Patrick > ___ > 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
[pmwiki-users] New warnings with php 8.1.2
Today I got a number of deprecated error messages in my pmwiki after setting up php to version 8.1.2 on arch linux. There seem to be new warnings in case of unset parameters to preg_repalce, strlen or strncmp. That happens for examplin pmwiki.php: Passing null to parameter #3 ($subject) of type array|string is deprecated in *pmwiki.php* on line *75* and also in some skin/cookbook scripts. Will there be a Version 2.3.2 with corrections? Greetings, Jürgen Godau ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] ABC tunebook
Sorry, I don't use the player. So, can anybody help David? regards, jürgen Am Mi., 11. Dez. 2019 um 20:31 Uhr schrieb : > Many thanks for your email. I seem to have it working except that since > most browsers no longer have the music player plug-in, how do you get the > tune to be played? > > > > Regards > > > > Dave Cooke > > > > *From:* Hans-Jürgen Godau > *Sent:* 19 July 2019 15:34 > *To:* David Cooke > *Cc:* PMWiki > *Subject:* Re: [pmwiki-users] ABC tunebook > > > > I use abctunebook. I made some mods to cope with php 7.2 and the latest > pmwiki-release. > > > > Here are my diffs: > > > > --- abctunebook/cookbook/abctunebook.php 2016-01-08 15:39:00.0 > +0100 > +++ cookbook/abctunebook.php 2018-11-13 12:43:55.756779161 +0100 > @@ -16,20 +16,23 @@ > > $RecipeInfo['AbcTunebook']['Version'] = '2016-01-08'; > > -SDV($AbcTunebooks['default'], 'Tunebook'); > +SDV($AbcTunebooks, array('default'=>'Tunebook', 0 => 'Liederbuch')); > + > + > SDV($AddTunePage, 'NewTune'); > > SDVA($Abcjs, array( > - 'dir' => $PubDirUrl.'/abcjs', > + 'dir' => $FarmPubDirUrl.'/abcjs', > 'base' => 'abcjs_base-min.js', > 'editor' => 'abc_editor.js', > + 'editor' => 'abc_editor.js', > 'plugin' => 'abc_plugin.js', > 'midi_program' => '1', > 'midi_qpm' => '160', > )); > > # (:abcjs:) directive will load abcjs plugin scripts even if page is not > in a tunebook group. > -Markup_e('abcjs', 'directives', '/\\(:abcjs:\\)/is', > "AbcjsLoadPlugin(\$pagename)"); > +Markup('abcjs', 'directives', '/\\(:abcjs:\\)/is', "AbcjsLoadPlugin"); > > # otherwise abcjs will not be loaded and markup rules not be set > $name = PageVar($pagename,'$Name'); > @@ -37,17 +40,21 @@ > if (!in_array($group, $AbcTunebooks)) return; > > # load abcjs plugin > -if($action=='browse') { > +if($action!='edit') { > AbcjsLoadPlugin($pagename); > - Markup_e('X:abc', '>[=','/(? \\]\n)(X:\\s*\\d+\\s*\n.*?)\n<:vspace>/s',"AbcTextMarkup(\$m[1])"); > - Markup_e('#abc', ' - '/\\[\\[#(abc\\d*)\\]\\](.*?)\\[\\[#\\1end\\]\\]/is', > "AbcTextMarkup(\$m[2],\$m[1])"); > + Markup('X:abc', '>[=','/(? \\]\n)(X:\\s*\\d+\\s*\n.*?)\n<:vspace>/s',"AbcTextMarkup"); > + Markup('#abc', ' + '/\\[\\[#(abc\\d*)\\]\\](.*?)\\[\\[#\\1end\\]\\]/is', > "AbcTextMarkup2"); > +} > + > +function AbcTextMarkup2($m) { > +return AbcTextMarkup($m,$m[1]); > } > > $FmtPV['$MidiTempo'] = '$GLOBALS[Abcjs]["midi_qpm"]'; > > -function AbcjsLoadPlugin($pagename) { > - global $Abcjs, $AbcTunebooks, $HTMLFooterFmt, $HTMLHeaderFmt, > $HTMLStylesFmt; > +function AbcjsLoadPlugin($m) { > + global $Abcjs, $AbcTunebooks, $HTMLFooterFmt, $HTMLHeaderFmt, > $HTMLStylesFmt, $pagename; > $speed = PageTextVar($pagename, 'speed'); > if (!$speed) $speed = 1; > $rhythm = PageTextVar($pagename, 'R'); > @@ -73,9 +80,9 @@ > "; > } > > -function AbcTextMarkup($text, $section=false) { > +function AbcTextMarkup($m, $section=false) { > static $cnt=0; $cnt++; > - $text = trim($text); > + $text = trim($m[2]); > $out = ''; > if ($section) { > $editlnk = "{[foxedit $section 'edit' > form=Site.FoxAbcTemplates#editabc]}"; > > > -- > > It seems to work for me, at least partially. I have some difficulties with > the inline-editor. > > > > Hope this helps, > > > > jürgen > > > > > > Am Di., 16. Juli 2019 um 04:44 Uhr schrieb David Cooke < > da...@ellendee.co.uk>: > > Is anyone using ABC tunebook and got it working. I used to use this a > while ago, I came back last week to rebuild my folk song website only to > find that it is now 'broken'. The last update was about 3 years ago with > the previous major PHP update. Now when I try to install it, I'm getting > loads of error messages and no music script. > > Regards > > > > *Dave Cooke* > > ___ > pmwiki-users mailing list > pmwiki-users@pmichaud.com > http://www.pmichaud.com/mailman/listinfo/pmwiki-users > > > This email has been scanned by BullGuard antivirus protection. > For more info visit www.bullguard.com > <http://www.bullguard.com/tracking.aspx?affiliate=bullguard=smtp=/> > ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Numbered Sections cookbook recipe
thank you. I will consider the new core feature, so maybe the recipe is made superfluous for me. Am Mi., 13. Nov. 2019 um 15:56 Uhr schrieb Petko Yotov <5...@5ko.fr>: > Thanks for sharing this. > > > $prefix=PSS($m[1]); > > $text=PSS($m[2]); > > You need to remove the PSS() calls from the new version. PSS() strips > one level of backslashes. It was previously needed in markup > replacements because preg_replace() with /eval added one level of > backslashes. The new PHP 5.5-7.2 way doesn't add backslashes, and using > PSS() may remove legitimate backslashes from the wiki text. > > > Maybe Petko could change this in the download-version? > > If the maintainer is unreachable, as the recipe is licensed GPL, you can > publish the changes yourself, and even take over the maintenance of the > recipe. > > BTW, if you also need a table of contents, the latest PmWiki version > includes a new table of contents feature that can also automatically > number sections, see $PmTOC['NumberedHeadings'] at this page: > >https://www.pmwiki.org/wiki/PmWiki/TableOfContents > > Core numbered headings currently depend on the table of contents, but > that should be refactored to become an independent function. Now, if the > sections are less than 3 (configurable), there is no TOC and the > headings are not numbered. > > Petko > > On 13/11/2019 15:23, Hans-Jürgen Godau wrote: > > I wanted to have numbered sections in my wiki-page, so I tried the > > numbered > > sections recipe and noticed, it still uses the deprecated "/e" Markup. > > so I > > changed the source with the following diff's: > > - > > --- Downloads/archive/pmwiki/numberedsections.php > > +++ numberedsections.php > > @@ -88,8 +88,8 @@ > > ## > > SDV ($DDNumFmt, '1.1.1.1.1.1'); > > > > -Markup('dd-num1','>include','/^(!{1,6})(?:\s*)(.*)$/e', > > "DDMkNumTitle(PSS('$1'),PSS('$2'))"); > > > -Markup('dd-num2','directives','/\\(:(no)?numbered-sections(?:\s+(.*?))?:\\)/e', > > "DDRunNum('$1',PSS('$2'))"); > > +Markup('dd-num1','>include','/^(!{1,6})(?:\s*)(.*)$/', > > "DDMkNumTitle"); > > > +Markup('dd-num2','directives','/\\(:(no)?numbered-sections(?:\s+(.*?))?:\\)/', > > "DDRunNum"); > > > > ## > > ## If numbered sections are enabled in the group or site header or > > footer, > > ensure they are not inherited > > @@ -101,8 +101,9 @@ > > $SiteHeaderFmt = $SiteHeaderFmt.'(:nonumbered-sections:)'; > > $SiteFooterFmt = '(:nonumbered-sections:)'.$SiteFooterFmt; > > > > - > > -function DDMkNumTitle ($prefix, $text) { > > +function DDMkNumTitle ($m) { > > + $prefix=PSS($m[1]); > > + $text=PSS($m[2]); > >global $DDNumFmt, $DDNumHdrEnable, $DDFmtSet, $DDDebug; > >static $FmtNb, $OrNb, $TcNb, $sp, $numoffset, $CurLvl; > > > > @@ -158,8 +159,10 @@ > > return chr(ord($num)-1); > > } > > > > -function DDRunNum ($nonum, $argstr) { > > +function DDRunNum ($m) { > >global $DDNumHdrEnable, $DDFmtSet, $DDNumFmt, $DDDebug; > > + $nonum = $m[1]; > > + $argstr = PSS($m[2]); > > > >$args = ParseArgs($argstr); > > - > > Maybe Petko could change this in the download-version? > ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
[pmwiki-users] Numbered Sections cookbook recipe
I wanted to have numbered sections in my wiki-page, so I tried the numbered sections recipe and noticed, it still uses the deprecated "/e" Markup. so I changed the source with the following diff's: - --- Downloads/archive/pmwiki/numberedsections.php +++ numberedsections.php @@ -88,8 +88,8 @@ ## SDV ($DDNumFmt, '1.1.1.1.1.1'); -Markup('dd-num1','>include','/^(!{1,6})(?:\s*)(.*)$/e', "DDMkNumTitle(PSS('$1'),PSS('$2'))"); -Markup('dd-num2','directives','/\\(:(no)?numbered-sections(?:\s+(.*?))?:\\)/e', "DDRunNum('$1',PSS('$2'))"); +Markup('dd-num1','>include','/^(!{1,6})(?:\s*)(.*)$/', "DDMkNumTitle"); +Markup('dd-num2','directives','/\\(:(no)?numbered-sections(?:\s+(.*?))?:\\)/', "DDRunNum"); ## ## If numbered sections are enabled in the group or site header or footer, ensure they are not inherited @@ -101,8 +101,9 @@ $SiteHeaderFmt = $SiteHeaderFmt.'(:nonumbered-sections:)'; $SiteFooterFmt = '(:nonumbered-sections:)'.$SiteFooterFmt; - -function DDMkNumTitle ($prefix, $text) { +function DDMkNumTitle ($m) { + $prefix=PSS($m[1]); + $text=PSS($m[2]); global $DDNumFmt, $DDNumHdrEnable, $DDFmtSet, $DDDebug; static $FmtNb, $OrNb, $TcNb, $sp, $numoffset, $CurLvl; @@ -158,8 +159,10 @@ return chr(ord($num)-1); } -function DDRunNum ($nonum, $argstr) { +function DDRunNum ($m) { global $DDNumHdrEnable, $DDFmtSet, $DDNumFmt, $DDDebug; + $nonum = $m[1]; + $argstr = PSS($m[2]); $args = ParseArgs($argstr); - Maybe Petko could change this in the download-version? Greetings, Hans-Jürgen ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] ABC tunebook
I use abctunebook. I made some mods to cope with php 7.2 and the latest pmwiki-release. Here are my diffs: --- abctunebook/cookbook/abctunebook.php 2016-01-08 15:39:00.0 +0100 +++ cookbook/abctunebook.php 2018-11-13 12:43:55.756779161 +0100 @@ -16,20 +16,23 @@ $RecipeInfo['AbcTunebook']['Version'] = '2016-01-08'; -SDV($AbcTunebooks['default'], 'Tunebook'); +SDV($AbcTunebooks, array('default'=>'Tunebook', 0 => 'Liederbuch')); + + SDV($AddTunePage, 'NewTune'); SDVA($Abcjs, array( - 'dir' => $PubDirUrl.'/abcjs', + 'dir' => $FarmPubDirUrl.'/abcjs', 'base' => 'abcjs_base-min.js', 'editor' => 'abc_editor.js', + 'editor' => 'abc_editor.js', 'plugin' => 'abc_plugin.js', 'midi_program' => '1', 'midi_qpm' => '160', )); # (:abcjs:) directive will load abcjs plugin scripts even if page is not in a tunebook group. -Markup_e('abcjs', 'directives', '/\\(:abcjs:\\)/is', "AbcjsLoadPlugin(\$pagename)"); +Markup('abcjs', 'directives', '/\\(:abcjs:\\)/is', "AbcjsLoadPlugin"); # otherwise abcjs will not be loaded and markup rules not be set $name = PageVar($pagename,'$Name'); @@ -37,17 +40,21 @@ if (!in_array($group, $AbcTunebooks)) return; # load abcjs plugin -if($action=='browse') { +if($action!='edit') { AbcjsLoadPlugin($pagename); - Markup_e('X:abc', '>[=','/(?/s',"AbcTextMarkup(\$m[1])"); - Markup_e('#abc', '[=','/(?/s',"AbcTextMarkup"); + Markup('#abc', ': > Is anyone using ABC tunebook and got it working. I used to use this a > while ago, I came back last week to rebuild my folk song website only to > find that it is now 'broken'. The last update was about 3 years ago with > the previous major PHP update. Now when I try to install it, I'm getting > loads of error messages and no music script. > > Regards > > > *Dave Cooke* > ___ > 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
[pmwiki-users] warning on continue in pmwiki.php from php 7.3
Hello, on my Arch-System, which updated php to 7.3, I now receive the warnings *Warning*: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in *pmwiki.php* on line *739* *Warning*: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in *pmwiki.php* on line *742* looking at the code, i saw that there is no difference in the function if "continue" would be replaced by "break". That would avoid the different meaning of "continue" in "C" and "php". diff for pmwki.php: 739c739 < continue; --- > break; 742c742 < continue; --- > break; Hope this helps, jürgen ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Deprecated: Function create_function() in line 481 of pmwiki.php
Thank you for your hints. I finally found the offending places/recipes. One (possible) hint: I undefined the Markup_e definition in pmwiki.php to get the stack-trace. Otherwise I would have missed one call... Is it correct that there is still a call to Markup_e in scripts/vardoc.php? Best regards, jürgen 2018-02-07 8:30 GMT+01:00 Petko Yotov <5...@5ko.fr>: > On 05/02/2018 14:00, Hans-Jürgen Godau wrote: > >> the info on pmwiki.org/Troubleshooting says, the warning should be gone >> with the latest release. >> But even after upgrading to 2.2.107 I still get >> this warning, caused by the Function PCCF in pmwiki.php. How can I get rid >> of it without setting error_reporting to ~E_DEPRECATED? >> > > > Unless an addon, skin, recipe or local customization calls the functions > PCCF(), Markup_e()/PPRA() with evaluated code, create_function(), PPRE(), > or create a custom pagelist sort orders the old way, indeed the warning > should be gone. > > If I have missed such a call from the PmWiki core, I'll fix it immediately > - more information on what steps you did will help me experience the > warning myself and fix it. > > If the PmWiki core does not raise a warning, see if the addons, skins, > recipes you use have a more recent PHP7.2-compatible version. You can > disable them all and re-enable them one after another to see which one(s) > trigger the warning. > > I recently rewrote the documentation about making addons work with PHP 7.2 > (and earlier), see the pages: > > http://www.pmwiki.org/wiki/PmWiki/Functions#PCCF > http://www.pmwiki.org/wiki/PmWiki/Functions#PPRE > http://www.pmwiki.org/wiki/PmWiki/CustomMarkup > http://www.pmwiki.org/wiki/PmWiki/CustomPagelistSortOrder > > If this is insufficient or appears too complex, I will offer assistance > for updating recipes and skins for PHP 7.2. > > Petko > > > ___ > 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
[pmwiki-users] Deprecated: Function create_function() in line 481 of pmwiki.php
Hello, the info on pmwiki.org/Troubleshooting says, the warning should be gone with the latest release. But even after upgrading to 2.2.107 I still get this warning, caused by the Function PCCF in pmwiki.php. How can I get rid of it without setting error_reporting to ~E_DEPRECATED? all the best, jürgen ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users