From 2b51276a82adda0833005908b3c3ad25b2792353 Mon Sep 17 00:00:00 2001 From: Charles Severance Date: Wed, 13 Nov 2024 20:32:04 -0500 Subject: [PATCH] Fix types on lineitem request --- src/Util/LTI13.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Util/LTI13.php b/src/Util/LTI13.php index ff4d9f1..23bd4b9 100644 --- a/src/Util/LTI13.php +++ b/src/Util/LTI13.php @@ -946,6 +946,10 @@ public static function deleteLineItem($lineitem_url, $access_token, &$debug_log= * @return mixed If this works it returns an array including the new line item url. If it fails, it returns a string. */ public static function createLineItem($lineitems_url, $access_token, $lineitem, &$debug_log = false) { + $scoreMaximum = $lineitem->scoreMaximum ?? 100; + $lineitem->scoreMaximum = is_numeric($scoreMaximum) ? floatval($scoreMaximum) : 100; + if ( ! is_string($lineitem->label ?? null) ) $lineitem->label = strval($lineitem->label ?? null); + if ( ! is_string($lineitem->resourceId ?? null) ) $lineitem->resourceId = strval($lineitem->resourceId ?? null); $lineitems_url = trim($lineitems_url);