Moodle

Error generated when entering a tag '4.2'

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 1.9
  • Fix Version/s: None
  • Component/s: Tags
  • Labels:
    None
  • Database:
    PostgreSQL
  • Affected Branches:
    MOODLE_19_STABLE

Description

This error was generated while trying to add a new 'interest' tag to a user's profile. The tag was deliberately entered as a float (to see what would happen).

ERROR: invalid input syntax for integer: " 4.2"

SELECT name FROM mdl_tag WHERE id = ' 4.2'

  • line 684 of lib/dmllib.php: call to debugging()
  • line 481 of lib/dmllib.php: call to get_recordset_sql()
  • line 421 of lib/dmllib.php: call to get_record_sql()
  • line 179 of tag/lib.php: call to get_record()
  • line 323 of tag/lib.php: call to tag_name()
  • line 457 of tag/lib.php: call to tag_name_from_string()
  • line 58 of user/editlib.php: call to update_item_tags()
  • line 111 of user/edit.php: call to useredit_update_interests()

This error is trivial in as much as the tag is not stored, and clicking on the continue button is available and works.

I expect that it is not possible to have tag names that are integers or floats, because the use of $tag_names_or_ids_cvs (a tag named with a number will be mistaken for an id passed here).

May I suggest a bit of javascript on the input fields for any tag entry that would inform the user that they has entered an illegal tag name, or a help button that explains the situation.

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

hmm, instead of working around the problem it might be better to remove the general parameters and use ids and names instead - the code would be much easier and faster IMO...

Show
Petr Škoda (skodak) added a comment - hmm, instead of working around the problem it might be better to remove the general parameters and use ids and names instead - the code would be much easier and faster IMO...
Hide
Mathieu Petit-Clair added a comment -

I'm closing this issue, as it duplicates the other one. We're working on it...

Show
Mathieu Petit-Clair added a comment - I'm closing this issue, as it duplicates the other one. We're working on it...

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: