Skip to content

Commit 578abb0

Browse files
committed
improve foxes for php 8.5 by avoiding @ silencing
1 parent 668fee1 commit 578abb0

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

demo/server/methodProviders/testsuite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function setCookies($cookies)
7070
isset($cookieDesc['httponly']) ? (bool)$cookieDesc['httponly'] : false
7171
);
7272
} else {
73-
/// @todo
73+
/// @todo what to do?
7474
}
7575
}
7676

src/Client.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,19 +1274,19 @@ protected function sendViaCURL($req, $method, $server, $port, $path, $opts)
12741274
$this->errstr = 'no response';
12751275
$resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] .
12761276
': ' . curl_error($curl));
1277-
@curl_close($curl);
1277+
if (PHP_MAJOR_VERSION < 8) curl_close($curl);
12781278
if ($opts['keepalive']) {
12791279
$this->xmlrpc_curl_handle = null;
12801280
}
12811281
} else {
12821282
if (!$opts['keepalive']) {
1283-
@curl_close($curl);
1283+
if (PHP_MAJOR_VERSION < 8) curl_close($curl);
12841284
}
12851285
$resp = $req->parseResponse($result, true, $opts['return_type']);
12861286
if ($opts['keepalive']) {
12871287
/// @todo if we got back a 302 or 308, we should not reuse the curl handle for later calls
12881288
if ($resp->faultCode() == PhpXmlRpc::$xmlrpcerr['http_error']) {
1289-
@curl_close($curl);
1289+
if (PHP_MAJOR_VERSION < 8) curl_close($curl);
12901290
$this->xmlrpc_curl_handle = null;
12911291
}
12921292
}
@@ -1442,7 +1442,7 @@ protected function createCURLHandle($req, $method, $server, $port, $path, $opts)
14421442
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
14431443
} else {
14441444
$this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install');
1445-
@curl_close($curl);
1445+
if (PHP_MAJOR_VERSION < 8) curl_close($curl);
14461446
return false;
14471447
}
14481448
break;
@@ -1457,7 +1457,7 @@ protected function createCURLHandle($req, $method, $server, $port, $path, $opts)
14571457
curl_setopt($curl, CURLOPT_HTTPAUTH, $opts['authtype']);
14581458
} elseif ($opts['authtype'] != 1) {
14591459
$this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
1460-
@curl_close($curl);
1460+
if (PHP_MAJOR_VERSION < 8) curl_close($curl);
14611461
return false;
14621462
}
14631463
}
@@ -1508,7 +1508,7 @@ protected function createCURLHandle($req, $method, $server, $port, $path, $opts)
15081508
curl_setopt($curl, CURLOPT_PROXYAUTH, $opts['proxy_authtype']);
15091509
} elseif ($opts['proxy_authtype'] != 1) {
15101510
$this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1511-
@curl_close($curl);
1511+
if (PHP_MAJOR_VERSION < 8) curl_close($curl);
15121512
return false;
15131513
}
15141514
}

src/Helper/XMLParser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,19 @@ public function parse($data, $returnType = self::RETURN_XMLRPCVALS, $accept = 3,
272272
}
273273
/// @todo bump minimum php version to 5.5 and use a finally clause instead of doing cleanup 3 times
274274
} catch (\Exception $e) {
275-
@xml_parser_free($parser);
275+
if (PHP_MAJOR_VERSION < 8) xml_parser_free($parser);
276276
$this->current_parsing_options = array();
277277
/// @todo should we set $this->_xh['isf'] and $this->_xh['isf_reason'] ?
278278
throw $e;
279279
} catch (\Error $e) {
280-
@xml_parser_free($parser);
280+
if (PHP_MAJOR_VERSION < 8) xml_parser_free($parser);
281281
$this->current_parsing_options = array();
282282
//$this->accept = $prevAccept;
283283
/// @todo should we set $this->_xh['isf'] and $this->_xh['isf_reason'] ?
284284
throw $e;
285285
}
286286

287-
@xml_parser_free($parser);
287+
if (PHP_MAJOR_VERSION < 8) xml_parser_free($parser);
288288
$this->current_parsing_options = array();
289289

290290
// BC

tests/WebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function request($path, $method = 'GET', $payload = '', $emptyPageOk =
4141
}
4242
$page = curl_exec($ch);
4343
$info = curl_getinfo($ch);
44-
@curl_close($ch);
44+
if (PHP_MAJOR_VERSION < 8) curl_close($ch);
4545

4646
$this->assertNotFalse($page, 'Curl request should not fail. Url: ' . @$info['url'] . ', Http code: ' . @$info['http_code']);
4747
if (!$emptyPageOk) {

0 commit comments

Comments
 (0)