SSL Labs ScoreSecurityHeaders.io Score

Log in to participate

There is no cost to join RicheyWeb, and membership is a requirement to submit bug reports and participate in the support forums.

HeadTag bug -- premature JFactory::getDocument() call

More
3 months 3 weeks ago #1718 by drlukacs
drlukacs created the topic: HeadTag bug -- premature JFactory::getDocument() call
Hi,

Since I installed HeadTag, my RSS feed's link stopped working, and displays the page itself instead of the feed. See for example this .

Following the suggestion of Yannick Gaultier, I discovered that the cause of the problem is that HeadTag calls JFactory::getDocument() prematurely, in the constructor, and thus an HTML document gets generated instead of allowing the routing to take its course. As Yannick explained:

As you like looking into code, this bug happens when a plugin calls JFactory::getDocument() or equivalent from the onAfterInitialize event. It's too early in the process and this forces Joomla to create an HTML document instead of an RSS ( it also happens with PDF). getDocument() should only be called after onAfterRoute.

I would propose that you move the code with getDocument() into onContentPrepare and onAfterRender.

Best wishes,
Gabor

Please Log in or Create an account to join the conversation.

More
3 months 3 weeks ago #1719 by michael
michael replied the topic: HeadTag bug -- premature JFactory::getDocument() call
This bit me on another extension I wrote. I'll put out an update shortly.

Please Log in or Create an account to join the conversation.

More
3 months 3 weeks ago #1720 by drlukacs
drlukacs replied the topic: HeadTag bug -- premature JFactory::getDocument() call
Thank you for the prompt response.

I thought I should also let you know that the auto-updating mechanism does not seem to work either. Your xml file is correct, but Joomla does not seem to be picking up the update.

If you could let me know via this forum when the update is available, it would be terrific.

Thank you for your time.

Please Log in or Create an account to join the conversation.

More
3 months 3 weeks ago #1721 by michael
michael replied the topic: HeadTag bug -- premature JFactory::getDocument() call
My site automation re-creates the update xml files at the top of every hour. I just pushed HeadTag 3.4.1, so the updatexml should recognize it in about 5 minutes (give or take with caching and CDN)

You can manually download it now though.

FYI, I was grabbing JDocument in the plugin __construct - so it was happening before onAfterInitialize - because this plugin operates both in content and at the system level, I ran this in onBeforeCompileHead, which should be safe enough since only HTML gets a compiled head. I may be able to clean up some unnecessary tests now, but the least I can do on short notice is to stop breaking your other extensions!

There will be a clean-up release soon.

Please Log in or Create an account to join the conversation.

More
3 months 3 weeks ago #1722 by michael
michael replied the topic: HeadTag bug -- premature JFactory::getDocument() call
make that 3.4.2

Please Log in or Create an account to join the conversation.

More
3 months 3 weeks ago #1723 by drlukacs
drlukacs replied the topic: HeadTag bug -- premature JFactory::getDocument() call

michael wrote: make that 3.4.2


Thank you. This seems to be working perfectly now.

Insofar as the updates are concerned, however: I had 3.2 installed. I can see 3.4 in the XML file, but for some reason, Joomla would not offer me to upgrade.

Could you possibly look into this? I would very much like to be receiving automatic updates....

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to add attachements.
  • Not Allowed: to edit your message.
Kunena Forum