Skip to content

Commit 3d708a6

Browse files
committed
update test
1 parent f51eadb commit 3d708a6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

ext/sockets/sockets.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,8 +1708,8 @@ PHP_FUNCTION(socket_recvfrom)
17081708
}
17091709
default:
17101710
zend_string_efree(recv_buf);
1711-
zval_ptr_dtor(&zpayload);
1712-
zval_ptr_dtor(&obj);
1711+
zval_ptr_dtor(&zpayload);
1712+
zval_ptr_dtor(&obj);
17131713
zend_value_error("unsupported ethernet protocol");
17141714
RETURN_THROWS();
17151715
}

ext/sockets/tests/socket_afpacket.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ if (!function_exists("posix_getuid") || posix_getuid() != 0) {
2626
var_dump($iindex);
2727

2828
socket_getpeername($s_c, $istr2, $iindex2);
29+
30+
$s_s = socket_create(AF_PACKET, SOCK_RAW, ETH_P_ALL);
31+
$v_bind = socket_bind($s_s, 'lo');
32+
33+
$buf = str_repeat("0", ETH_FRAME_LEN) .
34+
str_repeat("\xFF", 6) .
35+
str_repeat("\x11", 6) .
36+
"\x08\x00" .
37+
str_pad("TEST", 46, "\x00");
38+
39+
var_dump(socket_sendto($s_s, $buf, strlen($buf), 0, "lo", 1));
40+
2941
socket_close($s_c);
3042
?>
3143
--EXPECTF--
@@ -35,3 +47,4 @@ string(2) "lo"
3547
int(%i)
3648

3749
Warning: socket_getpeername(): unable to retrieve peer name [95]: %sot supported in %s on line %d
50+
int(1574)

0 commit comments

Comments
 (0)