? ? Pending

User tests: Successful: Unsuccessful:

avatar OctavianC
OctavianC
14 Jan 2020

Pull Request for Issue # .

Summary of Changes

Reset filter.assigned_cat_ids because another call of FieldsHelper::getFields() with no second parameter will still use the previous filter.assigned_cat_ids state.
Basically if you make two subsequent calls, one with the $item parameters supplied and the other one without any parameter:

FieldsHelper::getFields('com_content.article', $item);
FieldsHelper::getFields('com_content.article');

The second call will always have filter.assigned_cat_ids prepopulated by the previous call, causing it to return an incorrect value.

Testing Instructions

  • Content > Articles > Add New Article. Name it "Test Article" and assign it to "Uncategorised";
  • Content > Categories > Add New Category. Name it "Other Category";
  • Content > Articles > Add New Article. Name it "Other Article" and assign it to "Other Category";
  • Content > Fields > click on New to create a new field. It doesn't matter which type, just make sure to assign it to the "Other Category" only;
  • Create a new menu item - Menus > Main Menu > Add New Menu Item > set Menu Item Type to Articles > Single Article. Select the "Test Article";
  • Open components/com_content/views/article/tmpl/default.php and add the following code after defined('_JEXEC') or die;:

var_dump(FieldsHelper::getFields('com_content.article'));

  • View your article in the frontend.

Expected result

You should be able to see an array of ALL article fields since that's what you've requested.

Actual result

Either an empty array if the current article has no fields assigned or only current article's fields.

Documentation Changes Required

avatar OctavianC OctavianC - open - 14 Jan 2020
avatar OctavianC OctavianC - change - 14 Jan 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 14 Jan 2020
Category Administration com_fields
avatar OctavianC OctavianC - change - 14 Jan 2020
Title
Reset assigned_cat_ids
FieldsHelper::getFields() bug - assigned_cat_ids is prepopulated by previous call
avatar OctavianC OctavianC - edited - 14 Jan 2020
avatar richard67
richard67 - comment - 15 Jan 2020

@OctavianC Could you use the "Update branch" button at the bottom of your PR? This will retrigger also appveyor tests. I'd like to see if they will pass this time. I think that they failed is not related to this PR, but if they pass this time we can be sure. Thanks in advance.

avatar Quy Quy - change - 15 Jan 2020
Labels Added: ?
avatar richard67
richard67 - comment - 15 Jan 2020

@OctavianC Sorry, ignore my previous comment. Is already done.

avatar richard67 richard67 - test_item - 15 Jan 2020 - Tested successfully
avatar richard67
richard67 - comment - 15 Jan 2020

I have tested this item successfully on 769a2de


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

avatar jwaisner jwaisner - test_item - 15 Jan 2020 - Tested successfully
avatar jwaisner
jwaisner - comment - 15 Jan 2020

I have tested this item successfully on 769a2de


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

avatar richard67 richard67 - change - 15 Jan 2020
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 15 Jan 2020

RTC


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

avatar HLeithner HLeithner - change - 16 Jan 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-01-16 11:18:21
Closed_By HLeithner
Labels Added: ?
avatar HLeithner
HLeithner - comment - 16 Jan 2020

Thanks

Add a Comment

Login with GitHub to post a comment