?
avatar Quy
Quy
13 Mar 2017

Steps to reproduce the issue

Create a new field of checkboxes type.
Add a checkbox values.
Click Save & Close button.
Edit this field.
Click Save & Close button.

In the PHP error log:

PHP Warning:  json_decode() expects parameter 1 to be string, array given in \administrator\components\com_fields\models\field.php on line 159

PHP Warning:  json_decode() expects parameter 1 to be string, array given in \administrator\components\com_fields\models\field.php on line 160

System information (as much as possible)

PHP 5.6.3

avatar Quy Quy - open - 13 Mar 2017
avatar joomla-cms-bot joomla-cms-bot - change - 13 Mar 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Mar 2017
avatar Quy Quy - edited - 13 Mar 2017
avatar Quy Quy - edited - 13 Mar 2017
avatar yvesh
yvesh - comment - 13 Mar 2017

@Quy Latest staging? And can you add a screenshot how your checkbox configuration field looks like?

ping @laoneo

avatar Quy Quy - change - 14 Mar 2017
Title
json_decode() warning with checkboxes field type
json_decode() warning with checkbox/radio field type
avatar Quy Quy - edited - 14 Mar 2017
avatar Quy
Quy - comment - 14 Mar 2017

Yes, latest staging as of today.
checkboxes

avatar laoneo
laoneo - comment - 15 Mar 2017

I can't reproduce the issue. Did you had some old data as the field configuration got updated from repeatable to subform field.

avatar Quy
Quy - comment - 15 Mar 2017

This is a clean install with no data. Also tested on PHP 7.0.16 and got the same warning in the error log.

avatar laoneo
laoneo - comment - 16 Mar 2017

@yvesh could you reproduce the issue?

avatar yvesh
yvesh - comment - 16 Mar 2017

@laoneo Yep i can confirm it.. It's not shown because of the redirect in the controller.. But he's right it's in the logs:

[16-Mar-2017 11:38:06 Europe/Berlin] PHP Warning: json_decode() expects parameter 1 to be string, array given in /Users/g0ne/projects/joomla/joomla-cms/administrator/components/com_fields/models/field.php on line 160
[16-Mar-2017 11:38:06 Europe/Berlin] PHP Stack trace:
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 1. {main}() /Users/g0ne/projects/joomla/joomla-cms/administrator/index.php:0
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 2. JApplicationCms->execute() /Users/g0ne/projects/joomla/joomla-cms/administrator/index.php:51
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 3. JApplicationAdministrator->doExecute() /Users/g0ne/projects/joomla/joomla-cms/libraries/cms/application/cms.php:265
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 4. JApplicationAdministrator->dispatch() /Users/g0ne/projects/joomla/joomla-cms/libraries/cms/application/administrator.php:156
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 5. JComponentHelper::renderComponent() /Users/g0ne/projects/joomla/joomla-cms/libraries/cms/application/administrator.php:98
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 6. JComponentHelper::executeComponent() /Users/g0ne/projects/joomla/joomla-cms/libraries/cms/component/helper.php:369
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 7. require_once() /Users/g0ne/projects/joomla/joomla-cms/libraries/cms/component/helper.php:394
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 8. JControllerLegacy->execute() /Users/g0ne/projects/joomla/joomla-cms/administrator/components/com_fields/fields.php:29
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 9. JControllerForm->save() /Users/g0ne/projects/joomla/joomla-cms/libraries/legacy/controller/legacy.php:710
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 10. FieldsModelField->save() /Users/g0ne/projects/joomla/joomla-cms/libraries/legacy/controller/form.php:744
[16-Mar-2017 11:38:06 Europe/Berlin] PHP 11. json_decode() /Users/g0ne/projects/joomla/joomla-cms/administrator/components/com_fields/models/field.php:160

P.S.: For me, when there is no custom field published you should show a warning (enqueue a message) that they have to publish the plugins first.. No one will get that else wise :-)

avatar laoneo
laoneo - comment - 20 Mar 2017

Guess this one can be closed as we have a pr.

avatar zero-24
zero-24 - comment - 20 Mar 2017

PR is #14681

avatar zero-24 zero-24 - change - 20 Mar 2017
The description was changed
Title
json_decode() warning with checkbox/radio field type
[com_fields] json_decode() warning with checkbox/radio field type
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-03-20 08:53:10
Closed_By zero-24
avatar zero-24 zero-24 - close - 20 Mar 2017

Add a Comment

Login with GitHub to post a comment