Skip to content

Add mandatory fourth argument for content events in com_media#17133

Merged
HLeithner merged 1 commit intojoomla:stagingfrom
n9iels:to-few-arguments-mediamanger
May 12, 2019
Merged

Add mandatory fourth argument for content events in com_media#17133
HLeithner merged 1 commit intojoomla:stagingfrom
n9iels:to-few-arguments-mediamanger

Conversation

@n9iels
Copy link
Copy Markdown
Contributor

@n9iels n9iels commented Jul 14, 2017

Pull Request for Issue #17129

Summary of Changes

This PR adds a fourth argument to the dispatcher for the onContentBeforeDisplay and onContentAfterDisplay events. Without this argument the following error might occur if there is no fallback for this argument:

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

Testing Instructions

  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
  1. Apply the patch and confirm the error is solved

@ghost
Copy link
Copy Markdown

ghost commented Nov 5, 2017

Status is set on "Needs Review".

@mbabker
Copy link
Copy Markdown
Contributor

mbabker commented Jul 21, 2018

Seriously, this is rather simple...

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Jul 22, 2018

I have tested this item ✅ successfully on 614e122

Code review since the repo is no longer available.


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

@ghost ghost added the J3 Issue label Apr 5, 2019
@ghost ghost removed the J3 Issue label Apr 19, 2019
@alikon
Copy link
Copy Markdown
Contributor

alikon commented May 10, 2019

another task for @HLeithner

@alikon
Copy link
Copy Markdown
Contributor

alikon commented May 11, 2019

i was able to reproduce the error hacking the vote plugin as for test info
after apply pr the error is solved

@alikon
Copy link
Copy Markdown
Contributor

alikon commented May 11, 2019

I have tested this item ✅ successfully on 614e122


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

@alikon
Copy link
Copy Markdown
Contributor

alikon commented May 11, 2019

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label May 11, 2019
@ghost ghost removed the J3 Issue label May 11, 2019
@HLeithner HLeithner merged commit 4d7afdc into joomla:staging May 12, 2019
@HLeithner
Copy link
Copy Markdown
Member

Thx

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 12, 2019
@HLeithner HLeithner added this to the Joomla 3.9.7 milestone May 12, 2019
tecpromotion pushed a commit to tecpromotion/joomla-cms that referenced this pull request May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants