? Success

User tests: Successful: Unsuccessful:

avatar demis-palma
demis-palma
15 Apr 2014

Under some circumstances the "User selector" implicitly assumes that "no selection" means "user id = 0", which is a valid value to be saved in the database.
This brings to paradoxes, for example you can inserts records with user id = 0 even when the "user id" is a required filed.
For example: Go to User > User Notes and create a new note. There is no user selected, but it is a required field, as shown by the asterisk. Fill out "Subject" and "Note", but leave empty the user. Press the "Save & Close" button. You have just created a user note which is not associated to any user.

This is caused by an useless type cast to int, which turns invalid values like an empty string to 0 which is a valid id.

Under different circumstances the id is handled correctly simply by avoiding the type cast to int. For example, repeat the steps above, but before saving the record, press the user selection button. Once in the users list clear the selection by pressing the button "- No User -". This time the record won't be saved and a the message "Field required: User ID" will be displayed.

Tracker: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33620&start=0

In addition, this pull request fixes another potential bug:
when $this->value == 'CURRENT', the current user id is used to load the table, but the hidden field below ignores the loaded value and it continue using the string "current" stored in $this->value which of course is not a valid user id.

avatar demis-palma demis-palma - open - 15 Apr 2014
avatar demis-palma demis-palma - change - 15 Apr 2014
Title
User selector goes wrong in user id validation
[#33620] User selector goes wrong in user id validation
avatar zero-24 zero-24 - reference | - 16 Apr 14
avatar phproberto phproberto - reference | - 10 Jun 14
avatar phproberto phproberto - change - 10 Jun 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-06-10 02:35:18
avatar phproberto phproberto - close - 10 Jun 2014
avatar phproberto phproberto - close - 10 Jun 2014
avatar demis-palma
demis-palma - comment - 10 Jun 2014

Looking at the tracker http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_id=8103&tracker_item_id=33620 it seems that the patch has been accepted, but can I kindly ask why this pull request reports "This pull request is closed, but the demis-palma:patch-3 branch has unmerged commits."?

avatar Bakual
Bakual - comment - 10 Jun 2014

@demis-palma Your PR is merged, but not with a merge-commit. Roberto pulled it down, edited the commit message and pushed it with e882e47.
So it indeed is merged and you can delete your branch safely.

Add a Comment

Login with GitHub to post a comment