J3 Issue ?
avatar acs-ferreira
acs-ferreira
3 Sep 2019

Steps to reproduce the issue

Create a User > Radio custom field, editable in both Front an Admin.

image

image

Expected result

User can switch the radio (On or Off) on their profile or by an admin.

Actual result

User profile can't be saved (in both Front or Back) with an error:

Save failed with the following error: Duplicate entry '12' for key 'PRIMARY'

until field is unpublished (field has the id 12)

System information (as much as possible)

Joomla 3.9.11
MariaDB 10.4.7
PHP 7.2.21

avatar acs-ferreira acs-ferreira - open - 3 Sep 2019
avatar joomla-cms-bot joomla-cms-bot - change - 3 Sep 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Sep 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Sep 2019
Title
[J3] [com_fields] Radio custom field on User fails with DUPLICATE KEY
[com_fields] Radio custom field on User fails with DUPLICATE KEY
avatar franz-wohlkoenig franz-wohlkoenig - edited - 3 Sep 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 3 Sep 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 3 Sep 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 4 Sep 2019

@laoneo can you please comment?

avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Sep 2019
Status New Information Required
avatar laoneo
laoneo - comment - 4 Sep 2019

Would be good if somebody can try reproduce the issue, because on a quick test I couldn't on a fresh Joomla installation. Does it only happen for users or is it a general radio field issue?

avatar acs-ferreira
acs-ferreira - comment - 4 Sep 2019

@laoneo I've only tested with Radio and User as i don't need anything else.

What i don't understand is, why Joomla is trying to rewrite the same original field (id), and not trying to write a new value for that field (id) AND user (id)?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 4 Sep 2019

Can't confirm. Radio custom field is editable and can be saved in Front- and Backend as expected.

System Information

Setting Value
PHP Built On Linux lamp122.cloudaccess.net 3.10.0-962.3.2.lve1.5.24.7.el6h.x86_64 #1 SMP Mon Dec 17 12:02:35 EST 2018 x86_64
Database Type mysql
Database Version 5.7.24-cll-lve
Database Collation utf8mb4_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.3.8
Web Server Apache
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.9.12-dev Development [ Amani ] 12-August-2019 17:15 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:69.0) Gecko/20100101 Firefox/68.0
avatar acs-ferreira
acs-ferreira - comment - 4 Sep 2019

Have you both tried with several users?
Because in my side, field can be saved with the first user that tries to write it, not the next ones (it produces the DUPLICATE KEY error).

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 4 Sep 2019

Have you both tried with several users?

No, as it was not in "Steps to reproduce the issue".

avatar acs-ferreira
acs-ferreira - comment - 4 Sep 2019

I've tried it on a fresh Joomla, can't reproduce it too.
Yet, it happens on my >3K users Joomla installation.

What i don't understand is, why Joomla is trying to rewrite the same original field (id), and not trying to write a new value for that field (id) AND user (id)?

To clarify, Joomla is trying to rewrite the _fields table instead of writing a new value inside the _fields_values table.

Here, this is what i get when i save my custom field with the first (random) user i try to save the field.
image

But when i try to save it another (random) user:
image

And of course, nothing is write to the _fields_values table ?

I've tried to truncate all _fields* tables and restart creating the field, same result.

avatar acs-ferreira acs-ferreira - change - 4 Sep 2019
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2019-09-04 14:29:55
Closed_By acs-ferreira
avatar acs-ferreira
acs-ferreira - comment - 4 Sep 2019

Well, as sometimes it helps write things up to understand it, my _fields_values table had a primary key on the field_id so the error came from there...

Solved with a ALTER TABLE `xhtml57603_fields_values` DROP PRIMARY KEY;

avatar acs-ferreira acs-ferreira - close - 4 Sep 2019

Add a Comment

Login with GitHub to post a comment