TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 28, 2024, 08:12:01 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,104
  • Total Topics: 21,212
  • Online today: 143
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 143
  • Total: 144
  • tino

If this character & is included in the topic title, then on the block of recent.

Started by @rjen, April 25, 2021, 08:49:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tino

Quote from: lurkalot on May 03, 2021, 08:48:56 AM
Quote from: tino on May 02, 2021, 07:53:23 PM

Thought it might, it's a SMF issue then.


Thanks Tino. But when you say it's a SMF issue, do you mean it's a bug they have caused in SMF? or just something they have changed and we need to adapt TP for going forward?

Also you said it doesn't seem to happen with a clean install of 2.0.18, so is this something relevant only to the 2.0.18 patch they released?

They broke the short_subject string with certain installs with the latest update. TinyPortal just relays that information. My guess would be one of the changes from create_function to an anonymous function is not correct. This will be broken for anything which uses ssi_recentPosts and echos the shortened subject variable.

TinyPortal could get around it by shortening the subject itself, however it's really not an issue on our side.

@rjen

The cause is found, it is caused by a bug in SMF 2.0.18.
No problem in 2.0.17 and also no problem in SMF2.1

Issue reported at SMF:
https://www.simplemachines.org/community/index.php?topic=577637

The bug also affects the Frontpage topics (if these exceed the maximum number of characters set) and the TPDowloads descriptions on the category pages.

The fix for SMF 2.0.18 is in the Load.php file in the /sources folder:

Find:
'substr' => function($string, $start, $length = null) use ($utf8, $ent_check, $ent_list, $modSettings)
{
$ent_arr = preg_split('~(' . $ent_list . '|.)~' . ($utf8 ? 'u' : '') . '', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length));
},


Replace by:

'substr' => function($string, $start, $length = null) use ($utf8, $ent_check, $ent_list, $modSettings)
        {
            $ent_arr = preg_split('~(&#' . (empty($modSettings['disableEntityCheck']) ? '\d{1,7}' : '021') . ';|"|&|<|>| |.)~' . ($utf8 ? 'u' : '') . '', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
            return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length));
        },
Running Latest TP on SMF2.1 at: www.fjr-club.nl