mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Internet: explicitly assume return of curl_exec() is string after error checking
this is documented as string|bool, but it's actually string|false if CURLOPT_RETURNTRANSFER is set, and bool if not.
This commit is contained in:
parent
d246933e3e
commit
0c9d16f1ef
@ -227,10 +227,10 @@ class Internet{
|
||||
]);
|
||||
try{
|
||||
$raw = curl_exec($ch);
|
||||
$error = curl_error($ch);
|
||||
if($error !== ""){
|
||||
throw new InternetException($error);
|
||||
if($raw === false){
|
||||
throw new InternetException(curl_error($ch));
|
||||
}
|
||||
if(!is_string($raw)) throw new AssumptionFailedError("curl_exec() should return string|false when CURLOPT_RETURNTRANSFER is set");
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$rawHeaders = substr($raw, 0, $headerSize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user