Feed post bot

[Solved] HTML title attribute altered in forums list - Feed post bot

[Solved] HTML title attribute altered in forums list

by cabot » Wed Sep 21, 2022 11:07 am

Hello,

First of all, thank you for this amazing extension!

I wanted to report a small non-blocking issue: when the title of a feed contains quotes, the HTML title attribute of the subject on index and forums list is broken.

Example with this article.

Title of the article :
Guerre en Ukraine : à l'ONU, Emmanuel Macron dénonce un "retour à l'âge des impérialismes"
Code returned to the browser :

Code: Select all

<a href="./viewtopic.php?p=1408#p1408" title="Guerre en Ukraine : à l'ONU, Emmanuel Macron dénonce un " retour="" à="" l'âge="" des="" impérialismes""="" class="lastsubject">Guerre en Ukraine : à l'ONU, …</a>
Image

PHP version: 7.4
phpBB version: 3.3.8
Tested with unmodified prosilver
User avatar
cabot
Registered User
Posts: 799
Joined: Sat Jan 07, 2012 4:16 pm

Re: HTML title attribute altered in forums list

by Ger » Wed Sep 21, 2022 4:38 pm

Hmm, not sure about this one. It's simply an UTF-8 string passed to the submit_post() function. It's valid everywhere but breaks Prosilver that uses it as title tag. IMHO, Prosilver should clean / escape such characters to prevent breaking HTML.

Nice catch though.

Since I'm not running any phpbb installation anymore I can't really help you. But maybe you can test manually entering a topic with the exact same title. What does phpbb do in such case? If it does the same, you should report a bug in the general bug tracker. If it doesn't, I'm curious about what happens :)
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: HTML title attribute altered in forums list

by cabot » Wed Sep 21, 2022 5:50 pm

I just installed the extension on my demo forum so you can see the problem.

The forum "Feed post bot Ext" of the second category contains the topics retrieved by the extension, the last topic displayed on the index has the problem regardless of the style.
I have manually created a topic with the same title in the forum just below, it is displayed correctly.
User avatar
cabot
Registered User
Posts: 799
Joined: Sat Jan 07, 2012 4:16 pm

Re: HTML title attribute altered in forums list

by Ger » Thu Sep 22, 2022 9:03 am

Hmm, I see phpBB nowadays call utf8_encode_ucr($post_data['post_subject']) to prevent this. It replaces quotes (and emojis and such).
I think you can expand on this method: https://github.com/GerB/feedpostbot/blo ... #L615-L618
That's called on the post subject and handles emojis (not allowed in phpBB 3.2 days when this extension was written) but doesn't strip quotes and >, < etc.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: HTML title attribute altered in forums list

by cabot » Thu Sep 22, 2022 10:51 am

I have no knowledge of PHP, but do you mean I can delete this function and replace this line with $title = $rss_item['title'];?
User avatar
cabot
Registered User
Posts: 799
Joined: Sat Jan 07, 2012 4:16 pm

Re: HTML title attribute altered in forums list

by Ger » Thu Sep 22, 2022 12:27 pm

I would only add a line here: https://github.com/GerB/feedpostbot/blo ... r.php#L514

Code: Select all

$title = utf8_encode_ucr($title);
Totally untested, so test yourself first
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: HTML title attribute altered in forums list

by cabot » Thu Sep 22, 2022 1:04 pm

Seems to work like a charm, thx ! :)
User avatar
cabot
Registered User
Posts: 799
Joined: Sat Jan 07, 2012 4:16 pm