bug64124.phpt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Bug #64124 IPv6 malformed
  3. --CREDITS--
  4. Boris Lytochkin
  5. --EXTENSIONS--
  6. snmp
  7. --SKIPIF--
  8. <?php
  9. require_once(__DIR__.'/skipif.inc');
  10. $packed = str_repeat(chr(0), 15) . chr(1);
  11. if (@inet_ntop($packed) === false) {
  12. die("skip no IPv6 support");
  13. }
  14. ?>
  15. --FILE--
  16. <?php
  17. require_once(__DIR__.'/snmp_include.inc');
  18. # hostname variable was modified inline in netsnmp_session_init()
  19. # Should be checked with IPv6 since IPv4 processing code do not alter pointer position
  20. //EXPECTF format is quickprint OFF
  21. snmp_set_quick_print(false);
  22. snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
  23. $checkvar = "$hostname6_port";
  24. var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
  25. var_dump(($checkvar === $hostname6_port));
  26. var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
  27. var_dump(($checkvar === $hostname6_port));
  28. var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
  29. var_dump(($checkvar === $hostname6_port));
  30. ?>
  31. --EXPECTF--
  32. string(%d) "%s"
  33. bool(true)
  34. string(%d) "%s"
  35. bool(true)
  36. string(%d) "%s"
  37. bool(true)