-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Add socket_atmark unit test #9978
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
base: master
Are you sure you want to change the base?
Conversation
79a6ca4
to
7263019
Compare
ext/sockets/tests/socket_atmark.phpt
Outdated
--SKIPIF-- | ||
<?php | ||
|
||
if (getenv("SKIP_ONLINE_TESTS")) { |
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.
would be actually great not to do add another online test as those don't run in the pipeline. Would be great to convert to the server / client one which should still work.
ext/sockets/tests/socket_atmark.phpt
Outdated
$s_c = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("socket_create failed"); | ||
$s_bind = socket_bind($s_c, '0.0.0.0') or die("socket_bind failed"); | ||
$s_conn = socket_connect($s_c, 'www.php.net', 80) or die("socket_connect failed"); | ||
$string = "no chance of socket_atmark returning true"; | ||
$len = strlen($string); | ||
$s_w = socket_send($s_c, $string, $len, 0); | ||
if ($s_w != $len) | ||
die("socket_send failed"); | ||
if (socket_atmark($s_c) === FALSE) { | ||
if (socket_recv($s_c, $buf, $len, 0) != $len) | ||
die("socket_recv failed"); | ||
echo "not OOB"; | ||
} else { | ||
$buf = ""; | ||
if (socket_recv($s_c, $buf, 1, MSG_OOB) === FALSE) | ||
die("socket_recv failed"); | ||
echo "OOB"; | ||
} | ||
socket_close($s_c); |
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.
NIT: no indent
7263019
to
03bf0ee
Compare
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.
Thank you!
ext/sockets/tests/socket_atmark.phpt
Outdated
if (strtolower(substr(PHP_OS, 0, 3)) == 'win') { | ||
die("skip Windows"); | ||
} |
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.
if (strtolower(substr(PHP_OS, 0, 3)) == 'win') { | |
die("skip Windows"); | |
} | |
if (PHP_OS_FAMILY !== 'Windows') die("skip not for Windows"); |
03bf0ee
to
72cac52
Compare
No description provided.