Code assumes score is int, not stored in case of double

Created on 9 October 2019, almost 6 years ago
Updated 8 August 2025, 4 days ago

When storing a score in the database, the H5P code processing the AJAX request assumes the score is posted as an int.

h5p/src/Controller/H5PAJAX.php

    $score = filter_input(INPUT_POST, 'score', FILTER_VALIDATE_INT);

However, in some cases the H5P assignment breaks the score into a double. Due to this assumption in the code, scores that are not an int are not being stored in the h5p_points table and passed on in the FinishedEvent.

The same assumption is made in the table definition of h5p_points, so this would require to update the database as well.

🐛 Bug report
Status

Postponed: needs info

Component

Code

Created by

🇧🇪Belgium jeroenvl

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • I tried reproducing the issue but wasn't able to find an H5P content type with the ability to output fractional scores. Can anyone provide an example of an H5P that does so?

    If not, we should consider closing this issue.

Production build 0.71.5 2024