?
avatar n9iels
n9iels
14 Jul 2017

Steps to reproduce the issue

  1. Create onContentBeforeDisplay plugin event without a fallback variable for the $page parameter. Like this:
public function onContentBeforeDisplay($context, &$row, &$params, $page) {
}

You can also temporary remove the = 0 after the $page for a existing plugin. For example the vote plugin on this line: https://github.com/joomla/joomla-cms/blob/staging/plugins/content/vote/vote.php#L62
2. Set the error reporting to maximum
3. Go to the media manager and notice the following error:

Too few arguments to function PlgContentVote::onContentBeforeDisplay(), 3 passed in /usr/local/apache2/htdocs/libraries/joomla/event/event.php on line 70 and exactly 4 expected

Expected result

No errors or warning

Actual result

Too few arguments to function PlgContentVote::onContentBeforeDisplay(), 3 passed in /usr/local/apache2/htdocs/libraries/joomla/event/event.php on line 70 and exactly 4 expected

System information (as much as possible)

PHP 7.1.7
Latest Joomla! staging

Additional comments

The issue also appear in a older PHP version (PHP7.x). But it seems like that the latest php version raises a error with higher priority than previous versions.

The error is caused by multiple event dipatchers in the administrator/components/com_media/views/medialist/tmpl folder that call the onContentBeforeDisplay event without the the fourth argument, $page. A solution might be adding a 0 as fourth parameter. However I'm not sure if this is the right solution.

avatar n9iels n9iels - open - 14 Jul 2017
avatar joomla-cms-bot joomla-cms-bot - change - 14 Jul 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Jul 2017
avatar n9iels n9iels - change - 14 Jul 2017
The description was changed
avatar n9iels n9iels - edited - 14 Jul 2017
avatar zero-24
zero-24 - comment - 14 Jul 2017

hmm IMO we could just fix that in the core but any 3rd party that is triggering this event will throw that error too. This is what the default value is for. ;) For sure you can add the default (0) to the calling events where not done yet. But this would not fix the 3rd Party triggerd events.

avatar n9iels
n9iels - comment - 14 Jul 2017

I created a PR for this. I think that fixing for 3rd party extensions is very hard. We cannot change the event dispatcher specific for this event.
The default value is indeed exact for this situation :-)

avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Jul 2017
Category com_media
avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Jul 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-07-19 04:36:46
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 19 Jul 2017
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 19 Jul 2017
avatar joomla-cms-bot
joomla-cms-bot - comment - 19 Jul 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 19 Jul 2017

closed as having PR #17133


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

Add a Comment

Login with GitHub to post a comment