You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just ran into the subject error when trying to save a Drupal Commerce shipment. Here's the code that's involved:
/**
* Set the response.
*/
public function setResponse(mixed $response = ''): self
{
$this->response = $response;
return $this;
}
The issue is that the value of $response can be a boolean value or a string value. It can be boolean FALSE if, for example, the call to curl_exec from this line in function doRequest() fails:
$this->setResponse(curl_exec($ch));
If curl_exec fails, it's returns boolean FALSE and the attempt to assign FALSE to $this->response produces the TypeError. Here's a suggested fix:
/**
* Set the response.
*/
public function setResponse(mixed $response = ''): self
{
if (is_string($response)) {
$this->response = $response;
}
else {
$this->response = '';
}
return $this;
}
The text was updated successfully, but these errors were encountered:
I just ran into the subject error when trying to save a Drupal Commerce shipment. Here's the code that's involved:
The issue is that the value of $response can be a boolean value or a string value. It can be boolean FALSE if, for example, the call to curl_exec from this line in function doRequest() fails:
If curl_exec fails, it's returns boolean FALSE and the attempt to assign FALSE to $this->response produces the TypeError. Here's a suggested fix:
The text was updated successfully, but these errors were encountered: