Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

devnexen
Copy link
Member

No description provided.

--SKIPIF--
<?php

if (getenv("SKIP_ONLINE_TESTS")) {
Copy link
Member

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.

Comment on lines 14 to 32
$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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: no indent

Copy link
Member

@cmb69 cmb69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment on lines 8 to 10
if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
die("skip Windows");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
die("skip Windows");
}
if (PHP_OS_FAMILY !== 'Windows') die("skip not for Windows");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants