This repository has been archived by the owner on Dec 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 503
Rework of sockets to mimic php-src sockets API #839
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -662,13 +662,13 @@ public function getOption(int $level, int $name) : int{} | |
|
||
public function bind(string $host, int $port = 0) : bool{} | ||
|
||
public function listen(int $backlog) : bool{} | ||
public function listen(int $backlog = 0) : bool{} | ||
|
||
public function accept($class = self::class){} | ||
|
||
public function connect(string $host, int $port = 0) : bool{} | ||
|
||
public static function select(array &$read, array &$write, array &$except, int $sec = 0, int $usec = 0, int &$error = null){} | ||
public static function select(array &$read, array &$write, array &$except, int $sec, int $usec = 0, int &$error = null){} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, do you see any other issues? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing off the hop, this is the only thing I noticed. |
||
|
||
public function read(int $length, int $flags = 0){} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why you've changed this to return
false
, but conventionally, when the ZPP API fails to parse the input, it will returnnull
(thisnull
return is usually ignored in the docs, since only the correct usage is documented). Thesocket_set_option
function does the same internally. This leads to the following output:For parity with other internal functions, it would likely be best to keep these as returning
null
, too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
socket_set_option
has no explicit return type defined byZEND_BEGIN_ARG_INFO_EX
, but Socket::setOption usesZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX
. Without returnfalse
, this leads to the following output:$socket = new Socket(\Socket::AF_INET, \Socket::SOCK_STREAM, \Socket::SOL_TCP); $socket->getOption();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I do see the problem. This is also why the return type information macros are not particularly pervasive in php-src. I'm not so concerned what solution is chosen here (current solution looks fine).