So, my php is terrible being an FE engineer but need to fix something fairly quick.
I'm hitting an endpoint of an API that stack trace errors to/on this BE function:
/**
*
* @param string $token
* @return \stdClass|null
*/
protected function getInstance(string $token)
{
$instance = PubSub::getInstance($token);
return $instance;
}
Here is my fe code that is hitting it (angular1):
$http({
method: 'PUT',
url: $rootScope.quizURI + '/API/quiz/control/timer',
headers: {
'Content-Type': 'application/json',
'Authorization': $rootScope.teacher_token
},
data: {
'instance_token': $rootScope.teacherInstanceToken
}
}).then(function successCallback(response) {
$log.debug('response from control timer put', response);
});
Workings:
- Yes, $rootScope.teacher_token is a string.
- Yes, here there's a response error in the browser console:
Fatal error: Uncaught TypeError: Argument 1 passed to API\Controller\Base::getInstance() must be of the type string, null given, called
Any pointers would make my Easter ;)
EDIT:
Blunder on my part. A var was undefined wa wa waaaaa