J3 Issue ?
avatar go-source
go-source
30 Dec 2018

Steps to reproduce the issue

create a content plugin that triggers onContentAfterSave
My plugin works fine in backend (any Joomla or PHP version)
In the frontend it works fine with PHP 7.0.x. It breaks and shows error message with PHP 7.1 and above

Expected result

No error

Actual result

Too few arguments to function PlgSystemFields::onContentAfterSave(), 2 passed in /home/.../public_html/libraries/joomla/event/event.php on line 70 and at least 3 expected

Call stack

Function Location

1 () JROOT/plugins/system/fields/fields.php:43
2 PlgSystemFields->onContentAfterSave() JROOT/libraries/joomla/event/event.php:70
3 JEvent->update() JROOT/libraries/joomla/event/dispatcher.php:160
4 JEventDispatcher->trigger() JROOT/components/com_gsimporter/models/logform.php:350

System information (as much as possible)

Joomla 3.7, 3.8 and 3.9 - error irrespective to Joomla version
PHP 7.0.x no error
PHP 7.1 and above with error

Additional comments

original Joomla code is:
JROOT/libraries/joomla/event/event.php:70 => return call_user_func_array(array($this, $event), $args);

I suggest to add an argument to eliminate error - this solves the issue:
return call_user_func_array(array($this, $event), $args, 0);

avatar go-source go-source - open - 30 Dec 2018
avatar joomla-cms-bot joomla-cms-bot - labeled - 30 Dec 2018
avatar chmst
chmst - comment - 1 Jan 2019
avatar Quy
Quy - comment - 1 Jan 2019

@chmst This issue is for v3.

avatar chmst
chmst - comment - 1 Jan 2019

oops sorry

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Apr 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 4 Apr 2019
avatar SharkyKZ
SharkyKZ - comment - 19 May 2019

Can't reproduce this on core.

Looks like com_gsimporter passes only 2 arguments but it should be at least 3 in 3.x. See documentation https://docs.joomla.org/Plugin/Events/Content#onContentAfterSave.

avatar franz-wohlkoenig franz-wohlkoenig - change - 19 May 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-05-19 16:03:00
Closed_By franz-wohlkoenig
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 19 May 2019

closed as stated above.

avatar franz-wohlkoenig franz-wohlkoenig - close - 19 May 2019

Add a Comment

Login with GitHub to post a comment