socket_create_pair-wrongparams.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 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. Warning: socket_create_pair(): unable to create socket pair [%d]: %s not supported in %s on line %d
  25. bool(false)
  26. Warning: socket_create_pair(): invalid socket domain [31337] specified for argument 1, assuming AF_INET in %s on line %d
  27. Warning: socket_create_pair(): unable to create socket pair [%d]: %s not supported in %s on line %d
  28. bool(false)
  29. Warning: socket_create_pair(): invalid socket type [31337] specified for argument 2, assuming SOCK_STREAM in %s on line %d
  30. Warning: socket_create_pair(): unable to create socket pair [%d]: %s not supported %s on line %d
  31. bool(false)
  32. --CREDITS--
  33. Till Klampaeckel, till@php.net
  34. Berlin TestFest 2009