bug60749.phpt 694 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #60749: SNMP module should not strip non-standard SNMP port from hostname
  3. --CREDITS--
  4. Boris Lytochkin
  5. --EXTENSIONS--
  6. snmp
  7. --SKIPIF--
  8. <?php
  9. require_once(__DIR__.'/skipif.inc');
  10. ?>
  11. --FILE--
  12. <?php
  13. require_once(__DIR__.'/snmp_include.inc');
  14. $hostname = "php.net";
  15. $ip = gethostbyname($hostname);
  16. if (ip2long($ip) === FALSE) {
  17. echo "Could not resolve $hostname properly!\n";
  18. exit(1);
  19. }
  20. $port = 1161;
  21. $session = new SNMP(SNMP::VERSION_1, "$hostname:$port", $community, $timeout, $retries);
  22. $info = $session->info;
  23. if (!str_ends_with($info["hostname"], ":$port")) {
  24. echo "'" . $info["hostname"] . "' != '$ip:$port'\n";
  25. }
  26. var_dump($session->close());
  27. ?>
  28. --EXPECT--
  29. bool(true)