1
0
mirror of https://github.com/php/php-src.git synced 2026-04-03 14:12:38 +02:00
Files
archived-php-src/ext/sockets/tests/socket_clear_error.phpt
Nikita Popov b9fbbcc867 Use different error condition in socket test
The previously used error does not occur on FreeBSD and instead
causes the operation to time out.

Also clean up the test a bit. And make sure it actually tests
something -- the point is that socket_last_error() should be 0
after socket_clear_error(). It's kind of pointless if the test
uses a wildcard for the final result instead.
2021-05-19 09:48:17 +02:00

26 lines
676 B
PHP

--TEST--
void socket_clear_error ([ resource $socket ] ) ;
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br
--SKIPIF--
<?php
if (!extension_loaded('sockets')) {
die('SKIP sockets extension not available.');
}
if (substr(PHP_OS, 0, 3) == 'WIN' ) {
die('skip non-windows only test');
}
?>
--FILE--
<?php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_option($socket, -1, -1, -1);
var_dump(socket_last_error($socket));
socket_clear_error($socket);
var_dump(socket_last_error($socket));
?>
--EXPECTF--
Warning: socket_set_option(): Unable to set socket option [%s]: %s in %s on line %d
int(%d)
int(0)