summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoliy Belsky <ab@php.net>2012-06-14 16:04:13 (GMT)
committerAnatoliy Belsky <ab@php.net>2012-06-14 16:04:13 (GMT)
commitbf8b58429b7eafbf76d63e82e55f9b6f29e0b3a6 (patch)
tree91b94a9b72fc0073e16c34ca628d86a8345fc469
parentb04e8145c94babcfe76247e6ecfb2da41796f6c0 (diff)
parent280e3a4ec8616f4a32a5186463d475592d1eebda (diff)
downloadphp-bf8b58429b7eafbf76d63e82e55f9b6f29e0b3a6.tar.gz
Merge branch 'PHP-5.4'
* PHP-5.4: Fixed bug #62312 ext\sockets\tests\socket_import_stream-4.phpt fails
-rw-r--r--ext/sockets/tests/socket_import_stream-4-win.phpt106
-rw-r--r--ext/sockets/tests/socket_import_stream-4.phpt4
2 files changed, 109 insertions, 1 deletions
diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt
new file mode 100644
index 0000000..68b6582
--- /dev/null
+++ b/ext/sockets/tests/socket_import_stream-4-win.phpt
@@ -0,0 +1,106 @@
+--TEST--
+socket_import_stream: effects of closing
+--SKIPIF--
+<?php
+if (!extension_loaded('sockets')) {
+ die('SKIP sockets extension not available.');
+}
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+ die("skip Not Valid for Linux");
+}
+
+--FILE--
+<?php
+
+function test($stream, $sock) {
+ if ($stream !== null) {
+ echo "stream_set_blocking ";
+ print_r(stream_set_blocking($stream, 0));
+ echo "\n";
+ }
+ if ($sock !== null) {
+ echo "socket_set_block ";
+ print_r(socket_set_block($sock));
+ echo "\n";
+ echo "socket_get_option ";
+ print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+ echo "\n";
+ }
+ echo "\n";
+}
+
+echo "normal\n";
+$stream0 = stream_socket_server("udp://0.0.0.0:58380", $errno, $errstr, STREAM_SERVER_BIND);
+$sock0 = socket_import_stream($stream0);
+test($stream0, $sock0);
+
+echo "\nunset stream\n";
+$stream1 = stream_socket_server("udp://0.0.0.0:58381", $errno, $errstr, STREAM_SERVER_BIND);
+$sock1 = socket_import_stream($stream1);
+unset($stream1);
+test(null, $sock1);
+
+echo "\nunset socket\n";
+$stream2 = stream_socket_server("udp://0.0.0.0:58382", $errno, $errstr, STREAM_SERVER_BIND);
+$sock2 = socket_import_stream($stream2);
+unset($sock2);
+test($stream2, null);
+
+echo "\nclose stream\n";
+$stream3 = stream_socket_server("udp://0.0.0.0:58383", $errno, $errstr, STREAM_SERVER_BIND);
+$sock3 = socket_import_stream($stream3);
+fclose($stream3);
+test($stream3, $sock3);
+
+echo "\nclose socket\n";
+$stream4 = stream_socket_server("udp://0.0.0.0:58384", $errno, $errstr, STREAM_SERVER_BIND);
+$sock4 = socket_import_stream($stream4);
+socket_close($sock4);
+test($stream4, $sock4);
+
+echo "Done.\n";
+--EXPECTF--
+normal
+stream_set_blocking 1
+socket_set_block 1
+socket_get_option 2
+
+
+unset stream
+socket_set_block 1
+socket_get_option 2
+
+
+unset socket
+stream_set_blocking 1
+
+
+close stream
+stream_set_blocking
+Warning: stream_set_blocking(): %d is not a valid stream resource in %s on line %d
+
+socket_set_block
+Warning: socket_set_block(): An operation was attempted on something that is not a socket.
+ in %ssocket_import_stream-4-win.php on line %d
+
+Warning: socket_set_block(): unable to set blocking mode [0]: The operation completed successfully.
+ in %ssocket_import_stream-4-win.php on line %d
+
+socket_get_option
+Warning: socket_get_option(): unable to retrieve socket option [0]: An operation was attempted on something that is not a socket.
+ in %ssocket_import_stream-4-win.php on line %d
+
+
+
+close socket
+stream_set_blocking
+Warning: stream_set_blocking(): %d is not a valid stream resource in %s on line %d
+
+socket_set_block
+Warning: socket_set_block(): %d is not a valid Socket resource in %s on line %d
+
+socket_get_option
+Warning: socket_get_option(): %d is not a valid Socket resource in %s on line %d
+
+
+Done.
diff --git a/ext/sockets/tests/socket_import_stream-4.phpt b/ext/sockets/tests/socket_import_stream-4.phpt
index 33ab104..8095d8d 100644
--- a/ext/sockets/tests/socket_import_stream-4.phpt
+++ b/ext/sockets/tests/socket_import_stream-4.phpt
@@ -5,7 +5,9 @@ socket_import_stream: effects of closing
if (!extension_loaded('sockets')) {
die('SKIP sockets extension not available.');
}
-
+if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ die("skip Not Valid for Windows");
+}
--FILE--
<?php