? Success

User tests: Successful: Unsuccessful:

avatar okonomiyaki3000
okonomiyaki3000
17 Dec 2014

This can't be right, guys.

avatar okonomiyaki3000 okonomiyaki3000 - open - 17 Dec 2014
avatar jissues-bot jissues-bot - change - 17 Dec 2014
Labels Added: ?
avatar Bakual
Bakual - comment - 17 Dec 2014

I agree the code currently is obviously wrong.
I would love to have some tests because with this change, it will finally be possible to go into the else part of the method and I would like to have that part tested.

@okonomiyaki3000 Do you know the case where $replace isn't true and can add that as test instruction?

avatar okonomiyaki3000
okonomiyaki3000 - comment - 17 Dec 2014

Unfortunately, I don't know much about this code. I just happened to spot it and thought it should be fixed.

avatar Hackwar
Hackwar - comment - 17 Dec 2014

good catch. I don't know how to test either and would ask the maintainers to merge based on review.

avatar Bakual
Bakual - comment - 17 Dec 2014

I don't know how to test either and would ask the maintainers to merge based on review.

The thing is, currently nothing is broken. But with this change something may be broken depending if the else part actually works or not. Until that change, that part was probably never executed.

The PR certainly is correct in that the current code is wrong. But it may still break something because another bug could surface.
Thus I asked for tests and will not merge based on simple review.

avatar brianteeman brianteeman - change - 17 Dec 2014
Category Libraries Tags
avatar smz
smz - comment - 17 Dec 2014

If this can help...

I did some research and the involved method is always called with the 3rd parameter either unset (hence = true by default) or explicitly set to false. This latter case happens indirectly through the setNewTags() method, defined in /libraries/joomla/table/observer/tags.php, Line 169.

The place where it is called with false are:

/administrator/components/com_categories/models/category.php (Line 744)
/libraries/legacy/model/admin.php (Line 621)
avatar smz
smz - comment - 17 Dec 2014

It turns out that both the aforementioned calls to setNewTags() are from identical batchTag() methods defined inside the two classes JModelAdmin and CategoriesModelCategory extends JModelAdmin.

Now:

  • is it normal that in a class extending another class we have the same (almost) identical methods? Am I wrong or when extending a class it is unneeded to duplicate common code?
  • almost identical because the method in admin.php declares to reurn a void while it actually returns a boolean (fixed in category.php)
  • In any case it seems that the code has to do with tags batch processing
avatar Hackwar
Hackwar - comment - 17 Dec 2014

Feel free to scan through all backend models for this stuff and fix them correctly. Tags still is a mess.

avatar smz
smz - comment - 17 Dec 2014

@Hackwar will it be OK to remove the duplicated code in the extension class?

avatar Hackwar
Hackwar - comment - 17 Dec 2014

I did not look at the code. Maybe JModelAdmin needs fixing, too. So if it really is the same method, delete it. :smile:

avatar smz
smz - comment - 17 Dec 2014

@hackwar Good, thanks! (P.S.: I wrote you an e-mail: give it a look...)

avatar smz
smz - comment - 17 Dec 2014

@okonomiyaki3000 Elijah, if I decide to push a PR fixing all the above, it will make sense that I also include your fix. Is this OK for you?

avatar smz smz - reference | a6e26c6 - 17 Dec 14
avatar smz
smz - comment - 17 Dec 2014

Created #5459 which identify the problem and corrects it by extending this PR
Many thanks to @okonomiyaki3000: I didn't mean to steal your PR: your is honor of finding and fixing the issue!

avatar okonomiyaki3000
okonomiyaki3000 - comment - 17 Dec 2014

Really no problem at all.

avatar Bakual
Bakual - comment - 18 Dec 2014

Closing this one then in favor of #5459

avatar Bakual Bakual - change - 18 Dec 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-12-18 14:16:42
avatar Bakual Bakual - close - 18 Dec 2014
avatar Bakual Bakual - close - 18 Dec 2014
avatar okonomiyaki3000 okonomiyaki3000 - head_ref_deleted - 22 Dec 2014

Add a Comment

Login with GitHub to post a comment