[pmwiki-users] preg_replace (RFC)
Krait, Philippe
Philippe.Krait at thalesgroup.com.au
Thu Dec 4 15:44:02 CST 2014
Hi Hans,
Thanks for your e-mail, which shows a perfect understanding of the situation, at least from my perspective. Also, since my last e-mail I spent a painful evening trying to find the source of the errors. There are good news and bad news...
One good piece of news is that I finally understood what needed to be done. I must say that, despite the details on the troubleshooting page, it is still a bit obscure, as there are quite a few very technical terms about the complex specificities of PHP that I don't understand. But still, I managed to fix a number of my recipes and, because I've been using the same template all over the place, Is should be able to fix the others as well as soon as I've got more time to do it.
The other good piece of news is that not only are some recipes already fixed, but I could also fix the simplest of the remaining ones applying the same principles that I applied above. I have attached the ones that I've fixed, just in case it's any help, but I am not sure about the best way to do this in a proper manner (what comments to include, how to put it back on the site in the proper manner, etc.)
The bad news is that the fix only works for simple use of the Markup() function. Some other recipes use it in a more complex fashion, or use preg_replace /e in creative ways, and I am afraid to break everything if I start tinkering with them.
There are two that I use and been unable to fix:
* Attachtable: this is a very useful recipe that I use all the time, so if a fix could be provided, I would be very grateful
* WikiSh: I use this one much more infrequently, but it's a big beast...
That being said, thanks for the support so far. My only other suggestion is exactly the same as Hans, it would make things much easier if there could be an error message identifying the markup causing the warning (and even better if the recipe could be identified that way as well). Would it be possible to scan the markup arguments for the presence of the nefarious /e ?
Anyway, thanks again, and long live PmWiki.
Philippe
-----Original Message-----
From: Hans Bracker [mailto:design at softflow.co.uk]
Sent: Thursday, 4 December 2014 7:55 PM
To: Krait, Philippe
Cc: PmWiki Users
Subject: Re: [pmwiki-users] preg_replace (RFC)
Thursday, December 4, 2014, 12:37:26 AM, Philippe wrote:
>> I vote for option 3.
>> It is easy to understand and troubleshoot the problem.
> I'm really sorry, but it is not "easy to understand and troubleshoot
> the problem". I have been using PmWiki for many years, but I'm not a
> PHP Guru, and if it was that easy, it would have been fixed for all
> recipes in a wink. Please don't expect every "simple"
> user of PmWiki to have an in-depth knowledge of PHP and PmWiki itself.
> PmWiki is very user friendly in particular because it does not expect those.
I think you are right. It should not be expected for a site admin to fix the problems introduced by the update to PHP 5.5, which was most likely not done by her/him anyway. To be able to identify which recipe scripts or skins are generating these error messages would be nice.
Partly PHP does this and points to the script and code line involved.
An admin should hopefully be able to see by this what recipe is involved, and check if there is an updated PHP 5.5 compatible version available. Otherwise contact the recipe author or mention the problem here on the user list, where someone else may be able to help to fix the recipe. I have been relying on such error feedback from users about scripts I authored or co-authored.
But there are many PHP error messages pointing to pmwiki.php, which are not caused by pmwiki code directly, but by use of the Markup() function in recipes and skins using the /e modifier in the regular expression. I think Petko did a good job adding a PmWiki error message in such cases, which identifies the offending regular expression. But how can a site admin work out in which recipe or skin script this regular expression pattern is? Because that is not clear from the error message. A Markup() call with /e modifier could be anywhere, and an admin would not know, unless s/he has a good idea about the scripts involved and the regular expressions. One could make a text search on all cookbook and skin scripts for the offending regular expression pattern, I guess. So this is not an easy way to identify offending code and scripts. Still Petko provided a handle and I am grateful for that!
Could PmWiki be more specific to identify in which function call and script offending regular expressions reside? I don't see how.
So my vote is for option 3 (do nothing, although Petko has already done a lot to help flag the problems ). But in the end we might need to think about issuing warnings in the cookbook about the scripts and skins which are not PHP 5.5 compatible. Maybe they can all b searched for regular expressions with /e modifiers? But that does not sound
easy either. And sometimes RE patterns with /e modifier were
created, which do not appear inside a call to preg_replace or preg_match etc. Finding all these is difficult. Fixing them may prove difficult as well.
Best regards,
Hans
mailto:design at softflow.co.uk
www.softflow.co.uk
This message contains OPEN information that is not sensitive and can be freely accessed by people both inside and outside of the Thales Group
This email was classified by Krait, Philippe on Friday, 5 December 2014 8:44:01 AM
-------------------------------------------------------------------------
DISCLAIMER: This e-mail transmission and any documents, files and
previous e-mail messages attached to it are private and confidential.
They may contain proprietary or copyright material or information that
is subject to legal professional privilege. They are for the use of
the intended recipient only. Any unauthorised viewing, use, disclosure,
copying, alteration, storage or distribution of, or reliance on, this
message is strictly prohibited. No part may be reproduced, adapted or
transmitted without the written permission of the owner. If you have
received this transmission in error, or are not an authorised recipient,
please immediately notify the sender by return email, delete this
message and all copies from your e-mail system, and destroy any printed
copies. Receipt by anyone other than the intended recipient should not
be deemed a waiver of any privilege or protection. Thales Australia
does not warrant or represent that this e-mail or any documents, files
and previous e-mail messages attached are error or virus free.
-------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: highslide.php
Type: application/octet-stream
Size: 6414 bytes
Desc: highslide.php
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/817e3fb7/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTML5Video.php
Type: application/octet-stream
Size: 1708 bytes
Desc: HTML5Video.php
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/817e3fb7/attachment-0009.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: menus.php
Type: application/octet-stream
Size: 4009 bytes
Desc: menus.php
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/817e3fb7/attachment-0010.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postitnotes.php
Type: application/octet-stream
Size: 24370 bytes
Desc: postitnotes.php
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/817e3fb7/attachment-0011.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: progressbar.php
Type: application/octet-stream
Size: 2812 bytes
Desc: progressbar.php
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/817e3fb7/attachment-0012.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: swf.php
Type: application/octet-stream
Size: 1656 bytes
Desc: swf.php
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/817e3fb7/attachment-0013.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tablesplus.php
Type: application/octet-stream
Size: 3500 bytes
Desc: tablesplus.php
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/817e3fb7/attachment-0014.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autosave.php
Type: application/octet-stream
Size: 5032 bytes
Desc: autosave.php
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20141205/817e3fb7/attachment-0015.obj>
More information about the pmwiki-users
mailing list