socket_create_pair-wrongparams.phpt 917 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Test parameter handling in socket_create_pair()
  3. --EXTENSIONS--
  4. sockets
  5. --SKIPIF--
  6. <?php
  7. if (substr(PHP_OS, 0, 3) == 'WIN') {
  8. die('skip.. Not valid for Windows');
  9. }
  10. --FILE--
  11. <?php
  12. var_dump(socket_create_pair(AF_INET, 0, 0, $sockets));
  13. try {
  14. var_dump(socket_create_pair(31337, 0, 0, $sockets));
  15. } catch (\ValueError $e) {
  16. echo $e->getMessage() . \PHP_EOL;
  17. }
  18. try {
  19. var_dump(socket_create_pair(AF_INET, 31337, 0, $sockets));
  20. } catch (\ValueError $e) {
  21. echo $e->getMessage() . \PHP_EOL;
  22. }
  23. ?>
  24. --EXPECTF--
  25. Warning: socket_create_pair(): Unable to create socket pair [%d]: %s not supported in %s on line %d
  26. bool(false)
  27. socket_create_pair(): Argument #1 ($domain) must be one of AF_UNIX, AF_INET6, or AF_INET
  28. socket_create_pair(): Argument #2 ($type) must be one of SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET, SOCK_RAW, or SOCK_RDM
  29. --CREDITS--
  30. Till Klampaeckel, till@php.net
  31. Berlin TestFest 2009