Sample posting.
If this character & is included in the topic title, then on the block of recent posts this character is not displayed in the topic title, only & is displayed. This is a bug?
Referring to this:
https://www.simplemachines.org/community/index.php?topic=27642.msg4087377#msg4087377
Not seeing this issue on my test sites so far. Did you manage to replicate it?
Quote from: lurkalot on April 26, 2021, 07:28:36 AM
Not seeing this issue on my test sites so far. Did you manage to replicate it?
See the recent topics here...
Strange, I looked at this earlier and could have sworn it was ok. I see it now though.
What does calling ssi_recentPosts directely show? I can't see any where we encode the entity.
https://www.tinyportal.net/ssi_examples.php
it shows correctly..
What is this set to in the database? For me it's this;
Topic with & in it but it display's correctly on the page when rendering.
Quote from: tino on May 01, 2021, 06:48:20 PM
What is this set to in the database? For me it's this;
Topic with & in it but it display's correctly on the page when rendering.
You mean the messages table? MyISAM utf8_general_ci
And this is what's in the actual database.
Quote from: lurkalot on May 01, 2021, 07:24:37 PM
And this is what's in the actual database.
Thanks, so it's not double encoded. It's definitely an entity thing. I'll dig a bit more but it's working ok here on my test installs.
Thanks Tino. ;)
Strange one, it does it here on this site SMF 2.0.18 TP 2.0.1, but seems to be fine on some other sites running various versions.
This one running SMF 2.0.17 and TP 1.6.9 is ok, https://cctestsite.info/forums/index.php Until I upgrade it to 2.0.18 then the problem shows up. Roll it back to 2.0.17 and the issue is gone away.
This one is ok. running SMF 2.1 RC3 TP TinyPortal 2.0.1 https://cctestsite.info/testsite3/
Edited my post above with new findings. My 2.0.17 test site https://cctestsite.info/forums/index.php is fine until I upgrade it to 2.0.18 then that issue shows up, roll it back and it's gone away again.
Just tried this on here, and as you can see, rolling back to 2.0.17 seems to cure the problem.
Hmmm I can't recall if my test site was 2.0.18 or 2.0.17.
They messed with the entity logic in that upgrade mind. So that makes sense
Quote from: tino on May 02, 2021, 03:34:14 PM
Hmmm I can't recall if my test site was 2.0.18 or 2.0.17.
They messed with the entity logic in that upgrade mind. So that makes sense
This one from the 31st of Jan? "Entity check fix - needs to revert entities for amps in mb4 chars"
File: Sources/Load.php
It might be that one, you can try it on here with and without that change applied
Quote from: tino on May 02, 2021, 05:25:19 PM
It might be that one, you can try it on here with and without that change applied
Think it must be a different one tino, I edited the file but still the same issue. ;)
(Reverted Change).
Hmmm I'm running 2.0.18 and have no issues.
Quote from: tino on May 02, 2021, 06:47:31 PM
Hmmm I'm running 2.0.18 and have no issues.
Very strange. It definitely fixes it if I roll back to 2.0.17 This is on here and another site. My test site was actually still on 2.0.17 and that was how I discovered this when I upgraded (patched) it to 2.0.18 the problem was there immediately.
Give me a minute and I'll uninstall the 2.0.18 patch on here. ;)
Rolled back to 2.0.17, if you look at the recent block the issue is gone, or it is for me.
I can see that also. It's a clean install of 2.0.18 as I trashed all my old instances of TinyPortal on SMF recently. Although that shouldn't make a difference.
Can you edit TPsubs.template.php on here and change short_subject in the TPortal_recentbox function to subject?
Thanks, I don't think I have a clean install of 2.0.18 to test this atm, I will do that soon though now you've mentioned it. ;)
I'll install the 2.0.18 patch on here again now. ;)
Quote from: tino on May 02, 2021, 07:07:25 PM
Can you edit TPsubs.template.php on here and change short_subject in the TPortal_recentbox function to subject?
Yep will give it a go. ;)
echo '
<a href="' . $w['href'] . '" title="' . $w['subject'] . '">' . $w['short_subject'] . '</a>
', $txt['by'], ' <b>', $w['poster']['link'],'</b> ';
if (!(TP_SMF21) && ($w['is_new']))
Tino, did you mean change 'short_subject' to just 'subject' or did you actually mean 'subject?'
Change the name short_subject to subject
So $w['subject'], there's two instances in there to change I think.
Quote from: tino on May 02, 2021, 07:38:32 PM
Change the name short_subject to subject
So $w['subject'], there's two instances in there to change I think.
Thanks, yes there is two. ;)
Quote from: tino on May 02, 2021, 07:38:32 PM
Change the name short_subject to subject
So $w['subject'], there's two instances in there to change I think.
OK, done. You can see it fixed that issue, but the title is pretty long in the recent block now. ;)
Quote from: lurkalot on May 02, 2021, 07:45:28 PM
Quote from: tino on May 02, 2021, 07:38:32 PM
Change the name short_subject to subject
So $w['subject'], there's two instances in there to change I think.
OK, done. You can see it fixed that issue, but the title is pretty long in the recent block now. ;)
Thought it might, it's a SMF issue then.
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?
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.
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));
},