? Failure

User tests: Successful: Unsuccessful:

avatar ghost
ghost
9 Sep 2014

This is not only an issue of form field type "tag" but also for any multiple form field with class that

extends JFormFieldList

Steps to reproduce the issue

1) In an article add 2 or 3 tags. Save article. Close it.
2) In
/components/com_content/views/article/tmpl/edit.php
after
defined('_JEXEC') or die;
add line
$this->form->setFieldAttribute('tags', 'readonly', 'true');

OR(!)

add a readonly attribute to field definition of "tags" in
/components/com_content/models/forms/article.xml

field name="tags"
type="tag"
label="JTAG"
description="JTAG_DESC"
class="span12"
multiple="true"
readonly="true"

3) Set error reporting in Joomla configuration to maximum.
4) Reopen article of step 1).
5) You'll see a PHP warning
htmlspecialchars() expects parameter 1 to be string, array given in /libraries/joomla/form/fields/list.php on line 66
6) In disabled tags field you'll see your tags.
7) Save article.

Tags field is now empty and tag assignments to this article are removed from database

Additional comments

In /libraries/joomla/form/fields/list.php if readonly is active for a select box a hidden field is created that throws above warning/error because form field e.g. of type tag (extends JFormFieldList) sends $this->value as an array not as a single value.

avatar illovo illovo - open - 9 Sep 2014
avatar jissues-bot jissues-bot - change - 9 Sep 2014
Labels Added: ?
avatar ReLater
ReLater - comment - 10 Sep 2014

@test
Successfully tested with test instructions and 2 own components.

avatar brianteeman brianteeman - change - 10 Sep 2014
The description was changed
avatar infograf768
infograf768 - comment - 10 Sep 2014

Code style:
please add an empty line before the foreach.

avatar infograf768
infograf768 - comment - 11 Sep 2014

Test by guost has no value. User is deleted.

avatar zero-24
zero-24 - comment - 11 Sep 2014

@test thanks @illovo i can confirm the issue and your fix work good for me.

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar zero-24 zero-24 - change - 11 Sep 2014
Category Administration Tags
avatar zero-24 zero-24 - change - 11 Sep 2014
Easy No Yes
avatar b2z
b2z - comment - 21 Sep 2014

@test ok thanks for contributing!

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar b2z b2z - test_item - 21 Sep 2014 - Tested successfully
avatar zero-24
zero-24 - comment - 21 Sep 2014

thanks @b2z moving to RTC

This comment was created with the J!Tracker Application at http://issues.joomla.org/.

avatar zero-24 zero-24 - change - 21 Sep 2014
Status Pending Ready to Commit
avatar phproberto phproberto - change - 8 Oct 2014
Labels Added: ?
avatar phproberto phproberto - close - 8 Oct 2014
avatar phproberto phproberto - change - 8 Oct 2014
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2014-10-08 08:02:19
avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment