? ?
avatar boddunan
boddunan
17 Jan 2021

Steps to reproduce the issue

Create a form field for tag type as below.

<field name="tags" type="tag" label="JTAG" description="JTAG_DESC" multiple="true" published="1"></field>

This will show unpublished tags as well.

Expected result

It should show only tags with the published status 1

Actual result

Shows all tags including unpublished

System information (as much as possible)

Reproducible in both Joomla 3 and Joomla 4

Additional comments

Root cause:
src/Form/Field/TagField.php line 130
$published = $this->element['published'] ?: array(0, 1);

This returns an object with the attribute name as 0

However, the value was checked for numeric and array types as shown below.

// Filter on the published state
if (is_numeric($published))
{
  $published = (int) $published;
  $query->where($db->quoteName('a.published') . ' = :published')
    ->bind(':published', $published, ParameterType::INTEGER);
}
elseif (\is_array($published))
{
  $published = ArrayHelper::toInteger($published);
  $query->whereIn($db->quoteName('a.published'), $published);
}
avatar boddunan boddunan - open - 17 Jan 2021
avatar joomla-cms-bot joomla-cms-bot - change - 17 Jan 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Jan 2021
avatar chmst chmst - change - 19 Jan 2021
Labels Added: ?
avatar chmst chmst - labeled - 19 Jan 2021
avatar joomdonation
joomdonation - comment - 6 Feb 2021

PR #32065

avatar richard67 richard67 - change - 6 Feb 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-02-06 16:18:24
Closed_By richard67
Labels Added: ?
Removed: ?
avatar richard67 richard67 - close - 6 Feb 2021
avatar richard67
richard67 - comment - 6 Feb 2021

Closing as having a pull request. Please test #32332 . Thanks in advance.

avatar richard67
richard67 - comment - 6 Feb 2021

PR is #32332 .

Add a Comment

Login with GitHub to post a comment