php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch 61633.diff for Sockets related Bug #61633

Patch version 2012-04-05 13:47 UTC

Return to Bug #61633 | Download this patch
Patch Revisions:

Developer: ab@php.net

diff --git a/ext/sockets/tests/socket_create_pair-wrongparams.phpt b/ext/sockets/tests/socket_create_pair-wrongparams.phpt
index 99512bc..afca2b8 100644
--- a/ext/sockets/tests/socket_create_pair-wrongparams.phpt
+++ b/ext/sockets/tests/socket_create_pair-wrongparams.phpt
@@ -2,6 +2,9 @@
 Test parameter handling in socket_create_pair()
 --SKIPIF--
 <?php
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+	die('skip.. Not valid for Windows');
+}
 if (!extension_loaded('sockets')) {
     die('SKIP The sockets extension is not loaded.');
 }
--- a/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt	Thu Apr  5 15:40:30 2012
+++ b/ext/sockets/tests/socket_create_pair-wrongparams-win32.phpt	Thu Apr  5 15:40:30 2012
@@ -0,0 +1,38 @@
+--TEST--
+Test parameter handling in socket_create_pair()
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+	die('skip.. Not valid for non Windows');
+}
+if (!extension_loaded('sockets')) {
+    die('SKIP The sockets extension is not loaded.');
+}
+--FILE--
+<?php
+var_dump(socket_create_pair(AF_INET, null, null));
+
+$domain = 'unknown';
+var_dump(socket_create_pair($domain, SOCK_STREAM, 0, $sockets));
+
+var_dump(socket_create_pair(AF_INET, null, null, $sockets));
+
+var_dump(socket_create_pair(31337, null, null, $sockets));
+
+var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets));
+--EXPECTF--
+Warning: socket_create_pair() expects exactly 4 parameters, 3 given in %s on line %d
+NULL
+
+Warning: socket_create_pair() expects parameter 1 to be long, %unicode_string_optional% given in %s on line %d
+NULL
+bool(true)
+
+Warning: socket_create_pair(): invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d
+bool(true)
+
+Warning: socket_create_pair(): invalid socket type [31337] specified for argument 2, assuming SOCK_STREAM in %s on line %d
+bool(true)
+--CREDITS--
+Till Klampaeckel, till@php.net
+Berlin TestFest 2009
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 14:01:28 2024 UTC