Skip to content

Commit 5cd426c

Browse files
committed
Fixed major errors reported by scrutinizer
1 parent f5f93ab commit 5cd426c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Socket/Socket.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ protected function createClient($endpoint, $config = [])
270270
$verifyPeer = $this->config['ssl_verify_peer'];
271271
$verifyDepth = $this->config['ssl_verify_depth'];
272272

273+
$context = [];
273274
$context['socket'] = [
274275
'connect' => $endpoint
275276
];
276-
277277
$context['ssl'] = [
278278
'capture_peer_cert' => true,
279279
'capture_peer_chain' => true,
@@ -310,7 +310,7 @@ protected function createClient($endpoint, $config = [])
310310
$context
311311
);
312312

313-
if (!$socket || $errno)
313+
if (!$socket || $errno > 0)
314314
{
315315
throw new LogicException(
316316
sprintf('Could not connect socket [%s] because of error [%d; %s]', $endpoint, $errno, $errstr)

src/Socket/SocketListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,14 @@ protected function createServer($endpoint, $config = [])
378378
$reuseaddr = (bool) (isset($config['reuseaddr']) ? $config['reuseaddr'] : false);
379379
$reuseport = (bool) (isset($config['reuseport']) ? $config['reuseport'] : false);
380380

381+
$context = [];
381382
$context['socket'] = [
382383
'bindto' => $endpoint,
383384
'backlog' => $backlog,
384385
'ipv6_v6only' => true,
385386
'so_reuseaddr' => $reuseaddr,
386387
'so_reuseport' => $reuseport,
387388
];
388-
389389
$context['ssl'] = [
390390
'allow_self_signed' => !$verifySign,
391391
'verify_peer' => $verifyPeer,
@@ -425,7 +425,7 @@ protected function createServer($endpoint, $config = [])
425425
$context
426426
);
427427

428-
if (!$socket || $errno)
428+
if (!$socket || $errno > 0)
429429
{
430430
throw new LogicException(
431431
sprintf('Could not bind socket [%s] because of error [%d; %s]', $endpoint, $errno, $errstr)

0 commit comments

Comments
 (0)