@@ -1274,19 +1274,25 @@ discard block |
||
| 1274 | 1274 | $this->errstr = 'no response'; |
| 1275 | 1275 | $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . |
| 1276 | 1276 | ': ' . curl_error($curl)); |
| 1277 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); |
|
| 1277 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 1278 | + curl_close($curl); |
|
| 1279 | + } |
|
| 1278 | 1280 | if ($opts['keepalive']) { |
| 1279 | 1281 | $this->xmlrpc_curl_handle = null; |
| 1280 | 1282 | } |
| 1281 | 1283 | } else { |
| 1282 | 1284 | if (!$opts['keepalive']) { |
| 1283 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); |
|
| 1285 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 1286 | + curl_close($curl); |
|
| 1287 | + } |
|
| 1284 | 1288 | } |
| 1285 | 1289 | $resp = $req->parseResponse($result, true, $opts['return_type']); |
| 1286 | 1290 | if ($opts['keepalive']) { |
| 1287 | 1291 | /// @todo if we got back a 302 or 308, we should not reuse the curl handle for later calls |
| 1288 | 1292 | if ($resp->faultCode() == PhpXmlRpc::$xmlrpcerr['http_error']) { |
| 1289 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); |
|
| 1293 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 1294 | + curl_close($curl); |
|
| 1295 | + } |
|
| 1290 | 1296 | $this->xmlrpc_curl_handle = null; |
| 1291 | 1297 | } |
| 1292 | 1298 | } |
@@ -1442,7 +1448,9 @@ discard block |
||
| 1442 | 1448 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE); |
| 1443 | 1449 | } else { |
| 1444 | 1450 | $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install'); |
| 1445 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); |
|
| 1451 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 1452 | + curl_close($curl); |
|
| 1453 | + } |
|
| 1446 | 1454 | return false; |
| 1447 | 1455 | } |
| 1448 | 1456 | break; |
@@ -1457,7 +1465,9 @@ discard block |
||
| 1457 | 1465 | curl_setopt($curl, CURLOPT_HTTPAUTH, $opts['authtype']); |
| 1458 | 1466 | } elseif ($opts['authtype'] != 1) { |
| 1459 | 1467 | $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
| 1460 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); |
|
| 1468 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 1469 | + curl_close($curl); |
|
| 1470 | + } |
|
| 1461 | 1471 | return false; |
| 1462 | 1472 | } |
| 1463 | 1473 | } |
@@ -1508,7 +1518,9 @@ discard block |
||
| 1508 | 1518 | curl_setopt($curl, CURLOPT_PROXYAUTH, $opts['proxy_authtype']); |
| 1509 | 1519 | } elseif ($opts['proxy_authtype'] != 1) { |
| 1510 | 1520 | $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
| 1511 | - if (PHP_MAJOR_VERSION < 8) curl_close($curl); |
|
| 1521 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 1522 | + curl_close($curl); |
|
| 1523 | + } |
|
| 1512 | 1524 | return false; |
| 1513 | 1525 | } |
| 1514 | 1526 | } |
@@ -272,19 +272,25 @@ |
||
| 272 | 272 | } |
| 273 | 273 | /// @todo bump minimum php version to 5.5 and use a finally clause instead of doing cleanup 3 times |
| 274 | 274 | } catch (\Exception $e) { |
| 275 | - if (PHP_MAJOR_VERSION < 8) xml_parser_free($parser); |
|
| 275 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 276 | + xml_parser_free($parser); |
|
| 277 | + } |
|
| 276 | 278 | $this->current_parsing_options = array(); |
| 277 | 279 | /// @todo should we set $this->_xh['isf'] and $this->_xh['isf_reason'] ? |
| 278 | 280 | throw $e; |
| 279 | 281 | } catch (\Error $e) { |
| 280 | - if (PHP_MAJOR_VERSION < 8) xml_parser_free($parser); |
|
| 282 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 283 | + xml_parser_free($parser); |
|
| 284 | + } |
|
| 281 | 285 | $this->current_parsing_options = array(); |
| 282 | 286 | //$this->accept = $prevAccept; |
| 283 | 287 | /// @todo should we set $this->_xh['isf'] and $this->_xh['isf_reason'] ? |
| 284 | 288 | throw $e; |
| 285 | 289 | } |
| 286 | 290 | |
| 287 | - if (PHP_MAJOR_VERSION < 8) xml_parser_free($parser); |
|
| 291 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 292 | + xml_parser_free($parser); |
|
| 293 | + } |
|
| 288 | 294 | $this->current_parsing_options = array(); |
| 289 | 295 | |
| 290 | 296 | // BC |
@@ -41,7 +41,9 @@ |
||
| 41 | 41 | } |
| 42 | 42 | $page = curl_exec($ch); |
| 43 | 43 | $info = curl_getinfo($ch); |
| 44 | - if (PHP_MAJOR_VERSION < 8) curl_close($ch); |
|
| 44 | + if (PHP_MAJOR_VERSION < 8) { |
|
| 45 | + curl_close($ch); |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $this->assertNotFalse($page, 'Curl request should not fail. Url: ' . @$info['url'] . ', Http code: ' . @$info['http_code']); |
| 47 | 49 | if (!$emptyPageOk) { |