Skip to content

Commit 517c9ec

Browse files
authored
Merge pull request #39 from clue-labs/php8
Socket address of closed socket should be null (support PHP 8)
2 parents 0a225a5 + ee8f12c commit 517c9ec

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
php:
14+
- 8.0
1415
- 7.4
1516
- 7.3
1617
- 7.2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ $ composer require react/datagram:^1.5
4646
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
4747

4848
This project aims to run on any platform and thus does not require any PHP
49-
extensions and supports running on legacy PHP 5.3 through current PHP 7+ and
49+
extensions and supports running on legacy PHP 5.3 through current PHP 8+ and
5050
HHVM.
5151
It's *highly recommended to use PHP 7+* for this project.
5252

src/Socket.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,19 @@ public function __construct(LoopInterface $loop, $socket, Buffer $buffer = null)
3636

3737
public function getLocalAddress()
3838
{
39+
if ($this->socket === false) {
40+
return null;
41+
}
42+
3943
return $this->sanitizeAddress(@\stream_socket_get_name($this->socket, false));
4044
}
4145

4246
public function getRemoteAddress()
4347
{
48+
if ($this->socket === false) {
49+
return null;
50+
}
51+
4452
return $this->sanitizeAddress(@\stream_socket_get_name($this->socket, true));
4553
}
4654

0 commit comments

Comments
 (0)