News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Issue with specific char in topic name 2.0.18 to 2.0.19

Started by Sebastiii, April 13, 2022, 04:45:48 PM

Previous topic - Next topic

Sebastiii

Hello,
After migrating SMF forum from 2.0.18 to 2.0.19 topîc with specific char in the name was not loaded anymore.
I have found part of the culprit from load.php :

Original 2.0.18 line 175
$ent_list = empty($modSettings['disableEntityCheck']) ? '&(?>#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(?>#021|quot|amp|lt|gt|nbsp);';
$ent_check = empty($modSettings['disableEntityCheck']) ? function($string, $double = false)
{
$string = preg_replace_callback('~(&' . (!empty($double) ? '(?:amp;)?' : '') . '#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);

Change in 2.0.19 :
$ent_list = empty($modSettings['disableEntityCheck']) ? '&(?>#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(?>#021|quot|amp|lt|gt|nbsp);';
$ent_check = empty($modSettings['disableEntityCheck']) ? function($string, $double = false)
{
//$string = preg_replace_callback('~(&' . (!empty($double) ? '(?:amp;)?' : '') . '#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
// Restore 2018 version because it broke topic with "'" on word
$string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);

The culprit is that line :
$string = preg_replace_callback('~(&' . (!empty($double) ? '(?:amp;)?' : '') . '#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
For example, if we have a topic like this : Le [Journal] d'Astrid
We can see that there is the " ' " without quote, and it wasn't working on 2.0.19.

Maybe there is also other part of the code upgrade that has an issue related.
This is a French SMF version.

Is it enough to only revert that line ?

Thanks for your help

Kindred

Convert your forum to utf8?

Actually,  iirc, there was an issue with quotes in subjects. I think Shawn determined a patch
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sebastiii

Quote from: Kindred on April 13, 2022, 07:22:28 PMConvert your forum to utf8?
It is already in UTF8 :)
The issue start after the upgrade (patch).
I have also apply upgrade.php to migrate db to latest 2.0.19 to see if it solve the issue locally but not !

QuoteActually,  iirc, there was an issue with quotes in subjects. I think Shawn determined a patch
Ah, could be nice to know it, where I can find it ?
Thanks.

GL700Wing

Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Sebastiii

Quote from: GL700Wing on April 13, 2022, 08:19:23 PMAre you using the Pretty URLs mod?
Yes, and it wasn't updated :(

QuoteAnother user reported Problems with apostrophes and quotes in the title and it was resolved by updating that mod ...
It seems to be exactly the same issue, thanks for the link.

Will try to make an upgrade but will be tricky like all packages files from \Packages folder were removed, so updating can't work directly.

I have tried to upgrade locally on 2.0.18, and it was a mess, but it seems that I need to do/try again it then.

Kindred

Why were all packages removed?

You may have to start from clean files and reinstall mods
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sebastiii

Hi @Kindred ,
One year ago, our admin has cleaned up some folder because (\Package and cache folder) the forum was reachable, only able to go from the server side (SSH / FTP ...)
I don't why it happens but after the cleaning all was working again and a backup was made before at the time but was deleted now.

So, like we start to do some update, now we have seen that \Package folder shouldn't be touched.

So yes starting from clean file is the way to do but like there is many change with many MOD's, it's really not an easy task.

Thanks.

Sebastiii

Hello,
Upgraded to Pretty Urls 2.5 and now it works.
Thanks a lot :)

Doug Heffernan

Glad to see that the issue got solved. Thank you for letting us know.

Sebastiii

Quote from: Doug Heffernan on April 14, 2022, 07:57:39 AMGlad to see that the issue got solved. Thank you for letting us know.

Maybe I should open a new topic but, I just seen another issue related to quote ' in fact '

When receiving an email for a new post in the forum with text part, now the "'" are coded in "'"

For ex :
Je n'ai pas cherché, j'essaie
instead of :
Je n'ai pas cherché, j'essaie
Before the upgrade to 2.0.19, it was working correctly, I can't double-check locally, because I can't send email from my own windows Wamp server.

So I can't try to figure out if it's related to Pretty Urls or something else. But I think it's maybe related to the Pretty Urls MOD's because received email before the last update to Pretty Urls 2.5 seems working.

Thanks.

Doug Heffernan

Quote from: Sebastiii on April 14, 2022, 08:13:57 AMSo I can't try to figure out if it's related to Pretty Urls or something else. But I think it's maybe related to the Pretty Urls MOD's because received email before the last update to Pretty Urls 2.5 seems working.

Do you have a test 2.0.19 forum installed? If you do not have, you can install one and check if the issue will also occur there, in the freshly installed forum without any mods. If it will, then the chances are it is a bug, if it will not, then most likely it is related to the aforementioned mod, or another third party mod.

Sebastiii

Yes @Doug Heffernan
I have a copy of the site locally (on my PC) and also a fresh 2.0.19 version.
I will try to figure out about sending email setting to make it work locally and will doing some test to try to see where it failed.

Sebastiii

OK,
I was able to set up SMTP locally based on a copy of the website.
So reverting the line 178 like explain in first post, and it works

$string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
I even tried the one from SMF 2.1.1 :
$string = preg_replace_callback('~(&#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', (string) $string);
But it wasn't working !

So will be testing on fresh 2.0.19 forum ;)

Sebastiii

Ok,

Finally tested on fresh SMF 2.0.19 without plugins, and I'm running into the same issue.
Strangely, not for private message.

So for now, I have to revert to the old 2.0.18 line of code.
All seems to work, so no real clue.

Next step would be to test on latest SMF 2.1.1 to compare :

Sebastiii

Did the test with SMF 2.1.1 and no issue fresh and with Pretty Urls 2.5 :)
So I don't know what to do next, I'll keep with 2.0.18 line code for now, so must be something else in current 2.0.19 !

Thanks.

Advertisement: