Announcement

#1 2022-11-18 21:39:22

Cadencia
Member
Auckland, New Zealand
2013-10-12
20

Apostrophe in comments.

As requested by plg I create a new topic here.

Installed 13.2.0 today.

One small picky point.  When entering or editing comments containing an apostrophe, the apostrophe displays together with the escape character '\'.  Like "Harry's comment" displays as "Harry\s comment".

In a way it's a shame that English speakers use the apostrophe so much, even if often in the wrong place, grammatically speaking.

I have made a horrid bodge to work around the situation for my sites:

in include/functions_comments.inc.php:

220    \''.pwg_db_real_escape_string(stripslashes($comm['content'])).'\',

and

371     SET content = \''.pwg_db_real_escape_string(stripslashes($comment['content'])).'\',

Regards
Phil

Piwigo 13.2.0
Piwigo Originally Installed on 26 November 2014, 7 years 11 months 3 weeks 1 day ago
Operating system: Linux
PHP: 8.1.2-1ubuntu2.8 (Show info) [2022-11-18 19:06:31]
MySQL: 8.0.31-0ubuntu0.22.04.1 [2022-11-18 19:06:31]
Graphics Library: ImageMagick 6.9.11-60

Offline

 

#2 2022-11-19 16:30:33

windracer
Member
St. Pete, FL
2014-12-28
444

Re: Apostrophe in comments.

I've had issues with apostrophes in my descriptions before (see here: https://piwigo.org/forum/viewtopic.php?id=31560) but this was fixed for me in 13.2.0. And I'm not seeing the escaped apostrophes either, they appear as expected.

Offline

 

#3 2022-11-20 18:37:39

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13786

Re: Apostrophe in comments.

Here is the situation concerning quote escaping in Piwigo 13...

A long time ago, PHP (version 3 and 4, that's a very long time ago) was automatically escaping quotes in user inputs. Then they decided to disable this feature in PHP 5. Piwigo, if the feature was inactivate, applied the escape itself. Then PHP 8 decided to remove the possibility to test if the feature was active and we introduced a bug: a Piwigo 13 running on PHP 8 would not apply the quote escaping and this escaping was added in some specific places, like in the user comments registration or in the photo description form.

That was a mistake. We should have fixed the detection of the automatic escaping detection and not add some escapes in some specific places. In Piwigo 13.2.0 we fixed the detection, but we didn't remove the escape in the user comments (and maybe elsewhere, we're going to review that).

So now (in Piwigo 13.2.0) we has the automatic escape of all user inputs + specific escapes. Thus the extra escape you can see in the pages.

Offline

 

#4 2022-11-20 21:21:09

Cadencia
Member
Auckland, New Zealand
2013-10-12
20

Re: Apostrophe in comments.

Thank you for the explanation.  As a software developer myself I do appreciate that.

Regards
Phil

Offline

 

#5 2022-12-04 19:36:20

windracer
Member
St. Pete, FL
2014-12-28
444

Re: Apostrophe in comments.

windracer wrote:

And I'm not seeing the escaped apostrophes either, they appear as expected.

I'm seeing the escape/slashes before the apostrophe in my descriptions now, hmmm.

Offline

 

#6 2022-12-08 00:30:40

erAck
Only trying to help
2015-09-06
1998

Re: Apostrophe in comments.

include/functions_comment.inc.php missing in the 13.x_to_13.3.0.zip upgrade archive might be responsible for this. A full installation includes fixes in that file, an incremental upgrade does not.
See [Github] Piwigo issue #1818


Running Piwigo at https://erack.net/gallery/

Offline

 

#7 2022-12-08 00:55:05

windracer
Member
St. Pete, FL
2014-12-28
444

Re: Apostrophe in comments.

Nice find, thank you!

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact