Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media


Welcome, Guest. Please login or register.
Did you miss your activation email?

June 16, 2021, 06:13:36 PM

Login with username, password and session length
  • Total Posts: 192302
  • Total Topics: 20974
  • Online Today: 76
  • Online Ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 64
Total: 64

Author Topic: If this character & is included in the topic title, then on the block of recent.  (Read 2348 times)

0 Members and 1 Guest are viewing this topic.

Offline tino

  • Developer
  • *
  • Posts: 2364

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.

Offline @rjen

  • Support Team
  • *
  • Posts: 2892
    • FJR-club Nederland
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:

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:

Code: [Select]
'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:
Code: [Select]
'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 TP2.0.1 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info