?
avatar sandewt
sandewt
20 Sep 2017

Steps to reproduce the issue

If you open an article, wich is part of an Article Category List and in wich a module is loaded with loadposition, the module is loaded twice. This can break (custom) code in Joomla! 3.8.0.

  • Load p.e. the module Latest User in an article.
  • Use the {loadpostion xxxx} method.
  • This article should be part of an Article Category List.
  • Open the link to this article via the Article Category List.
  • Open the Joomla! Debug Console > Profile information (settings in the Global Configuration).
  • See that the module mod_user_latest is loaded twice.

Expected result

  • Module should be loaded once.

Actual result

  • Module is loaded twice.

System information (as much as possible)

  • Joomla! 3.8.0
  • Windows 10
  • Xampp

Additional comments

See image: example J3.8.0

debug

Attention to: (2 x 2)
Application: beforeRenderModule mod_users_latest (Users Latest (copy))
Application: afterRenderModule mod_users_latest (Users Latest (copy))

In Joomla! 3.7.5 the module is loaded once. (OK)

Votes

# of Users Experiencing Issue
0/1
Average Importance Score
5.00

avatar sandewt sandewt - open - 20 Sep 2017
avatar joomla-cms-bot joomla-cms-bot - change - 20 Sep 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Sep 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Sep 2017
Category com_modules
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Sep 2017
Status New Discussion
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Sep 2017

looks similar to #17999


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18016.

avatar sandewt sandewt - change - 20 Sep 2017
The description was changed
avatar sandewt sandewt - edited - 20 Sep 2017
avatar ggppdk
ggppdk - comment - 20 Sep 2017

Reason seems to be that 'onContentPrepare' is trigger twice
once for ->text and once for ->introtext

#17175

see also
#17830

I don't say that triggering plugins twice for same text is bad,
thus is do not say that PR 17175 is bad

  • but several plugins are not designed to be triggered twice for same text

e.g. in this issue we don't have bad side effects

and yes issue #17999 looks same as this one but in that case the double loaded module has some bad side-effects

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Sep 2017

@ggppdk so i close this Issue as duplicated Report?

avatar ggppdk
ggppdk - comment - 20 Sep 2017

@franz-wohlkoenig

issue #17999 shows an important side effect of double loading of modules as a result of the double plugin triggering on same text

but then we have another side-effect

i cannot say to close any of them, since people will resubmit them ?

Also the title of this issue is wrong / misleading , and should be fixed !

This issue is about article view that was opened via a link from Article Category List
So this issue is about article view !

avatar joomla-cms-bot joomla-cms-bot - change - 20 Sep 2017
Title
Module loaded twice in Article Category List
Article View that was opened via a link from Article Category List: Module loaded twice
avatar joomla-cms-bot joomla-cms-bot - edited - 20 Sep 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 20 Sep 2017
Title
Module loaded twice in Article Category List
Article View that was opened via a link from Article Category List: Module loaded twice
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 20 Sep 2017

@ggppdk please have a Look at updated Title.

avatar sandewt
sandewt - comment - 20 Sep 2017

Indeed, I have tested using the js code from issue #17999, the title should be about article view.
The debugger shows sometimes other results !?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18016.
avatar sandewt
sandewt - comment - 21 Sep 2017

For me is it an issue, because functions will be double loaded, which leads to a fatal error: Cannot redeclare myfunction() / previously declared in...

With the following restriction, it concerns own code!
I solve this problem with the following code: if (!function_exists('myfunction')) { etc.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18016.

avatar aardgoose
aardgoose - comment - 21 Sep 2017

Plugins are called twice where the complete text is displayed and no intro text is defined by markers etc.

This is certainly an plugin API change, and in my case breaks a site, and is adding extra processing server side for all pages.

#17175 is problematical and changes the plugin API.

avatar chiefguru61
chiefguru61 - comment - 22 Sep 2017

This has broken my site and caused me three days of problems trying to workout why some custom code loaded in articles via jumi and {loadposition xxx} didn't work and other bits did.

Data saved in the session was being processed twice.

I have resolved the issue by moving my custom code out of the article an into another position on the page.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18016.

avatar regularlabs
regularlabs - comment - 22 Sep 2017

This is a serious issue.
Content plugins are now pretty much all triggered twice.
This causes a whole range of issues. The least bad being that pages load slower, as plugins are doing the same thing twice.
The worst case scenario is that fatal errors happen because of things being triggered/executed twice that shouldn't be.

When I remove the code added through #17175 the issue is gone.
That change should be reverted asap, as it is a B/C change!

avatar laoneo
laoneo - comment - 22 Sep 2017

If #17175 get reverted then we need to find a solution how to prepare the intro text. @regularlabs what do you suggest?

avatar regularlabs
regularlabs - comment - 22 Sep 2017

I guess this is needed for the custom fields?
Solve it in the custom fields plugin.

avatar regularlabs
regularlabs - comment - 22 Sep 2017

The code in #17175 assumes plugins are not already doing stuff to the intro text.
But the entire $item is passed. So plugins already have the power and ability to do stuff separately on the $item->introtext, $item->fulltext and $item->text.
And many plugins are already doing that.

The onContentPrepare event doesn't expect a single string and do stuff on there. It handles a complete article object.
#17175 messes with the values of the article object and just runs onContentPrepare again.

avatar regularlabs
regularlabs - comment - 22 Sep 2017

Example of what plugins do inside the onContentPrepare:

public function onContentPrepare($context, &$article, &$params)
{
	if (isset($article->title))
	{
		doStuffWithContent($article->title);
	}

	if (isset($article->description))
	{
		doStuffWithContent($article->description);
	}

	if (isset($article->text))
	{
		doStuffWithContent($article->text);

		// don't also do stuff on introtext/fulltext if text is set
		return;
	}

	if (isset($article->introtext))
	{
		doStuffWithContent($article->introtext);
	}

	if (isset($article->fulltext))
	{
		doStuffWithContent($article->fulltext);
	}
}
avatar laoneo
laoneo - comment - 22 Sep 2017

Ok, got it, will prepare a pr over the weekend.

avatar regularlabs
regularlabs - comment - 22 Sep 2017

Ok, great :)

avatar laoneo
laoneo - comment - 22 Sep 2017

Please test #18066, it should fix the issue.

avatar franz-wohlkoenig franz-wohlkoenig - change - 22 Sep 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-09-22 12:04:04
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 22 Sep 2017
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 22 Sep 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 22 Sep 2017

closed as having Pull Request #18066


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/18016.

avatar joomla-cms-bot
joomla-cms-bot - comment - 22 Sep 2017
avatar sandewt
sandewt - comment - 23 Sep 2017

Thanks all.

Add a Comment

Login with GitHub to post a comment