-
Notifications
You must be signed in to change notification settings - Fork 7.9k
test to function stream_socket_sendto(); #1804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3f57a56
test to function stream_socket_sendto();
marcosptf c2de9b4
Update stream_socket_sendto.phpt
marcosptf 0739849
Update stream_socket_sendto.phpt
marcosptf ddb477c
Update stream_socket_sendto.phpt
marcosptf e8b0432
Update stream_socket_sendto.phpt
marcosptf 9ab8886
Update stream_socket_sendto.phpt
marcosptf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--TEST-- | ||
int stream_socket_sendto ( resource $socket , string $data [, int $flags = 0 [, string $address ]] ); | ||
--CREDITS-- | ||
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br | ||
--SKIPIF-- | ||
<?php | ||
if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); } | ||
?> | ||
--FILE-- | ||
<?php | ||
$serverUri = "tcp://127.0.0.1:31854"; | ||
$serverUrl = "http://php.net"; | ||
$stringSocket = "out of band data."; | ||
$stringFWrite = "normal data to transmit"; | ||
$sock = stream_socket_server($serverUri, $errno, $errstr); | ||
|
||
if (is_resource($sock)) { | ||
fwrite($sock, $stringFWrite); | ||
var_dump(stream_socket_sendto()); | ||
var_dump(stream_socket_sendto($sock)); | ||
var_dump(stream_socket_sendto($sock, $stringSocket)); | ||
var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB)); | ||
var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB, $serverUri)); | ||
var_dump(stream_socket_sendto($sock, $stringSocket, STREAM_OOB, $serverUrl)); | ||
} else { | ||
die("Test stream_socket_enable_crypto has failed; Unable to connect: {$errstr} ({$errno})"); | ||
} | ||
?> | ||
--CLEAN-- | ||
<?php | ||
fclose($sock); | ||
unset($sock); | ||
unset($serverUri); | ||
unset($serverUrl); | ||
unset($stringSocket); | ||
unset($errno); | ||
unset($errstr); | ||
?> | ||
|
||
--EXPECTF-- | ||
Notice: fwrite(): send of %i bytes failed with errno=%i Broken pipe in %s on line %i | ||
|
||
Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %i | ||
bool(%s) | ||
|
||
Warning: stream_socket_sendto() expects at least %i parameters, %i given in %s on line %i | ||
bool(%s) | ||
|
||
Warning: stream_socket_sendto(): Broken pipe | ||
in %s on line %i | ||
int(%i) | ||
|
||
Warning: stream_socket_sendto(): Broken pipe | ||
in %s on line %i | ||
int(%i) | ||
|
||
Warning: stream_socket_sendto(): php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %i | ||
|
||
Warning: stream_socket_sendto(): Failed to resolve %s: php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %i | ||
|
||
Warning: stream_socket_sendto(): Failed to parse %s into a valid network address in %s on line %i | ||
bool(%s) | ||
|
||
Warning: stream_socket_sendto(): php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %i | ||
|
||
Warning: stream_socket_sendto(): Failed to resolve %s: php_network_getaddresses: getaddrinfo failed: Name or service not known in %s on line %i | ||
|
||
Warning: stream_socket_sendto(): Failed to parse %s into a valid network address in %s on line %i | ||
bool(%s) |
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 forgot to mention, but the entire --CLEAN-- section is not needed, as I explained in another PR, then its run in a separate script after, so the variables do no longer exists, if anything, this should be done in --FILE--, but php already does this once the script ends :)
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.
Besides the removal of the --CLEAN-- section, then this PR is fine, thanks for your work!