diff --git a/plugin/ims_lti/auth.php b/plugin/ims_lti/auth.php index 315f338fe6..28571d1866 100644 --- a/plugin/ims_lti/auth.php +++ b/plugin/ims_lti/auth.php @@ -220,8 +220,10 @@ try { array_walk_recursive( $jwtContent, function (&$value) { - $value = preg_replace('/\s+/', ' ', $value); - $value = trim($value); + if (gettype($value) === 'string') { + $value = preg_replace('/\s+/', ' ', $value); + $value = trim($value); + } } ); diff --git a/plugin/ims_lti/src/ImsLti.php b/plugin/ims_lti/src/ImsLti.php index b3bde3daed..d636d63207 100644 --- a/plugin/ims_lti/src/ImsLti.php +++ b/plugin/ims_lti/src/ImsLti.php @@ -120,7 +120,9 @@ class ImsLti ? $substitute['claim'] : "https://purl.imsglobal.org/spec/lti{$substitute['claim']}"; - $substitute = $launchParams[$claim][$substitute['property']]; + $substitute = empty($substitute['property']) + ? $launchParams[$claim] + : $launchParams[$claim][$substitute['property']]; } else { continue; } @@ -129,12 +131,16 @@ class ImsLti $customParams[$customKey] = $substitute; } - return array_map( - function ($value) { - return (string) $value; - }, - $customParams + array_walk_recursive( + $customParams, + function (&$value) { + if (gettype($value) !== 'array') { + $value = (string) $value; + } + } ); + + return $customParams; } /**