socket_create_pair-wrongparams-win32.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Test parameter handling in socket_create_pair()
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != 'WIN') {
  6. die('skip.. Not valid for non Windows');
  7. }
  8. if (!extension_loaded('sockets')) {
  9. die('SKIP The sockets extension is not loaded.');
  10. }
  11. --FILE--
  12. <?php
  13. var_dump(socket_create_pair(AF_INET, null, null));
  14. $domain = 'unknown';
  15. var_dump(socket_create_pair($domain, SOCK_STREAM, 0, $sockets));
  16. var_dump(socket_create_pair(AF_INET, null, null, $sockets));
  17. var_dump(socket_create_pair(31337, null, null, $sockets));
  18. var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets));
  19. --EXPECTF--
  20. Warning: socket_create_pair() expects exactly 4 parameters, 3 given in %s on line %d
  21. NULL
  22. Warning: socket_create_pair() expects parameter 1 to be int, string given in %s on line %d
  23. NULL
  24. bool(true)
  25. Warning: socket_create_pair(): invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d
  26. bool(true)
  27. Warning: socket_create_pair(): invalid socket type [31337] specified for argument 2, assuming SOCK_STREAM in %s on line %d
  28. bool(true)
  29. --CREDITS--
  30. Till Klampaeckel, till@php.net
  31. Berlin TestFest 2009