[pmwiki-users] PHP7 Problems with HG Plugin

Petko Yotov 5ko at 5ko.fr
Tue Aug 21 10:16:56 PDT 2018

On that recipe I don't see a copyright notice allowing modification and 
redistribution, so I cannot upload an updated version.

I can tell you how to modify your own copy so that recent PHP versions 
do not complain about "preg_replace(): The /e modifier is no longer 

This requires at least PmWiki 2.2.58, latest version is strongly 
recommended (read the release notes before upgrading).

Replace the line:
   Markup('[[hg','<links', '/\\[\\[(-|[\\*\\^]+)(.*?)\\]\\]/e', 
"hgLinks1('$1', PSS('$2'))");

with this:
   Markup('[[hg','<links', '/\\[\\[(-|[\\*\\^]+)(.*?)\\]\\]/', 

Next, replace the first line of the function:
   function hgLinks1($x,$y) {

with these 2 lines:
   function hgLinks1($m) {
     list($z,$x,$y) = $m;

(change the arguments $x,$y with $m then insert a new line).

Last, change this line:
   Markup('hgbreadcrumb', '>var', '/\(:breadcrumb:\)/e', 

with this one:
   Markup('hgbreadcrumb', '>var', '/\(:breadcrumb:\)/', 'hgBreadCrumb');

Please note, I have neither reviewed the quality of the recipe, nor 
extensively tested it and I don't have the potential to support it. This 
is a technical update of only the bits that are required for PHP 7.

Please test it well and report if it works.


If you upgrade :  http://www.pmwiki.org/Upgrades

On 16/08/2018 10:07, 123_dirk wrote:
> Hi,
> after 6 years of using pmwiki i have to change to PHP7 .
> I'm using the old HG plugin, but i can't fix the PHP Code.
> Please, can someone make the HG Plugin PHP7 ready.

More information about the pmwiki-users mailing list