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

Recent

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

May 13, 2021, 01:13:08 PM

Login with username, password and session length
Members
Stats
  • Total Posts: 192247
  • Total Topics: 20970
  • Online Today: 101
  • Online Ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 1
Guests: 68
Total: 69

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

0 Members and 1 Guest are viewing this topic.

Offline tino

  • Developer
  • *
  • Posts: 2355

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.

Online @rjen

  • Support Team
  • *
  • Posts: 2874
    • 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:
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:
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