mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-14 22:01: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{
|
try{
|
||||||
$raw = curl_exec($ch);
|
$raw = curl_exec($ch);
|
||||||
$error = curl_error($ch);
|
if($raw === false){
|
||||||
if($error !== ""){
|
throw new InternetException(curl_error($ch));
|
||||||
throw new InternetException($error);
|
|
||||||
}
|
}
|
||||||
|
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);
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||||
$rawHeaders = substr($raw, 0, $headerSize);
|
$rawHeaders = substr($raw, 0, $headerSize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user