Failure

User tests: Successful: Unsuccessful:

avatar nextend
nextend
15 Jul 2013

will be unsynced with the methods array.

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_id=8103&tracker_item_id=31072

When a custom plugin loaded by:
JPluginHelper::importPlugin('test', 'mytestplugin');

There is an indexing issue in JEventDispatcher::attach method. The $observer parameter is NOT array, so it skip into the else state and there is a missing end pointer setup on the $this->_observers array. So when the next step get out key($this->_observers), it gets the previous plugin index, which will result failer of the loaded plugin.

Old code:

$this->_observers[] = $observer;
$methods = array_diff(get_class_methods($observer), get_class_methods('JPlugin'));

The code should be like this:

$this->_observers[] = $observer;
$methods = array_diff(get_class_methods($observer), get_class_methods('JPlugin'));
end($this->_observers);

avatar nextend nextend - open - 15 Jul 2013
avatar Hackwar
Hackwar - comment - 2 Mar 2014

I've proposed a slightly better code. When you merge that into your PR, I'm going to get this a little bit more attention and we can hopefully merge this soon. :-)

avatar nextend
nextend - comment - 3 Mar 2014

Great! It is nice to see that it will be part of the core Joomla, soon...

avatar Bakual
Bakual - comment - 3 Mar 2014

Imho code looks fine and makes sense. It's a bit hard to test however.
@mbabker Can we merge this without tests?

avatar Hackwar
Hackwar - comment - 4 Mar 2014

Here is a tracker item that describes this in a different way and is a bit more verbose: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31072&start=0
Closing the other as duplicate of this one.

avatar brianteeman brianteeman - change - 21 Aug 2014
Status New Pending
Build .
avatar brianteeman brianteeman - change - 19 Sep 2014
The description was changed
avatar brianteeman brianteeman - change - 17 Oct 2014
Category Libraries
avatar wilsonge
wilsonge - comment - 17 Oct 2014

This was fixed in 791f561 and can be closed

avatar Bakual
Bakual - comment - 17 Oct 2014

Closed as fixed elsewhere. Thanks!

avatar Bakual Bakual - close - 17 Oct 2014
avatar Bakual Bakual - change - 17 Oct 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-10-17 14:15:08
avatar Bakual Bakual - change - 17 Oct 2014
Title
I think there should be set the pointer to the end as plugin indexing
[#31072] I think there should be set the pointer to the end as plugin indexing

Add a Comment

Login with GitHub to post a comment