Skip to content

Commit

Permalink
Merge pull request #39 from clue-labs/php8
Browse files Browse the repository at this point in the history
Socket address of closed socket should be null (support PHP 8)
  • Loading branch information
jsor authored Feb 2, 2021
2 parents 0a225a5 + ee8f12c commit 517c9ec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
strategy:
matrix:
php:
- 8.0
- 7.4
- 7.3
- 7.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $ composer require react/datagram:^1.5
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

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

Expand Down
8 changes: 8 additions & 0 deletions src/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ public function __construct(LoopInterface $loop, $socket, Buffer $buffer = null)

public function getLocalAddress()
{
if ($this->socket === false) {
return null;
}

return $this->sanitizeAddress(@\stream_socket_get_name($this->socket, false));
}

public function getRemoteAddress()
{
if ($this->socket === false) {
return null;
}

return $this->sanitizeAddress(@\stream_socket_get_name($this->socket, true));
}

Expand Down

0 comments on commit 517c9ec

Please sign in to comment.