PHP  
 PHP_HEAD
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/snmp/tests/snmp-object-error.phpt ('OO API: Generic errors')

Script

1: <?php
2:
require_once(__DIR__.'/snmp_include.inc');
3:
4:
//EXPECTF format is quickprint OFF
5:
snmp_set_quick_print(false);
6:
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
7:
8: try {
9:     
var_dump(new SNMP(SNMP::VERSION_1$hostname));
10: } catch (
TypeError $e) {
11:     print 
$e->getMessage() . "\n";
12: }
13: try {
14:     
var_dump(new SNMP(SNMP::VERSION_1$hostname$community''));
15: } catch (
TypeError $e) {
16:     print 
$e->getMessage() . "\n";
17: }
18: try {
19:     
var_dump(new SNMP(SNMP::VERSION_1$hostname$community$timeout''));
20: } catch (
TypeError $e) {
21:     print 
$e->getMessage() . "\n";
22: }
23: try {
24:     
var_dump(new SNMP(7$hostname$community));
25: } catch (
Exception $e) {
26:     print 
$e->getMessage() . "\n";
27: }
28:
29: echo 
"Exception handling\n";
30:
$session = new SNMP(SNMP::VERSION_3$hostname$user_noauth$timeout$retries);
31: try {
32:     
var_dump($session->get('.1.3.6.1.2.1.1.1..0'));
33: } catch (
SNMPException $e) {
34:     
var_dump($e->getCode());
35:     
var_dump($e->getMessage());
36: }
37:
$session->exceptions_enabled SNMP::ERRNO_ANY;
38: try {
39:     
var_dump($session->get('.1.3.6.1.2.1.1.1..0'));
40: } catch (
SNMPException $e) {
41:     
var_dump($e->getCode());
42:     
var_dump($e->getMessage());
43: }
44:
var_dump($session->close());
45:
46: echo 
"Open normal session\n";
47:
$session = new SNMP(SNMP::VERSION_3$hostname$user_noauth$timeout$retries);
48:
$session->valueretrieval 67;
49:
var_dump($session->valueretrieval);
50: echo 
"Closing session\n";
51:
var_dump($session->close(''));
52:
var_dump($session->close());
53:
var_dump($session->get('.1.3.6.1.2.1.1.1.0'));
54:
var_dump($session->close());
55:
56:
$session = new SNMP(SNMP::VERSION_2c$hostname$community$timeout$retries);
57:
var_dump($session->walk('.1.3.6.1.2.1.1'FALSE''));
58:
var_dump($session->walk('.1.3.6.1.2.1.1'FALSE30''));
59:
var_dump($session->get());
60:
var_dump($session->getnext());
61:
var_dump($session->set());
62:
63:
var_dump($session->max_oids);
64:
$session->max_oids "ttt";
65:
$session->max_oids 0;
66:
var_dump($session->max_oids);
67:
?>
68:

Expected

SNMP::__construct() expects at least 3 parameters, 2 given
SNMP::__construct() expects parameter 4 to be int, string given
SNMP::__construct() expects parameter 5 to be int, string given
Unknown SNMP protocol version
Exception handling

Warning: SNMP::get(): Invalid object identifier: .1.3.6.1.2.1.1.1..0 in %s on line %d
bool(false)
int(32)
string(46) "Invalid object identifier: .1.3.6.1.2.1.1.1..0"
bool(true)
Open normal session

Warning: main(): Unknown SNMP value retrieval method '67' in %s on line %d
int(%d)
Closing session

Warning: SNMP::close() expects exactly 0 parameters, 1 given in %s on line %d
bool(false)
bool(true)

Warning: SNMP::get(): Invalid or uninitialized SNMP object in %s on line %d
bool(false)
bool(true)

Warning: SNMP::walk() expects parameter 3 to be int, string given in %s on line %d
bool(false)

Warning: SNMP::walk() expects parameter 4 to be int, string given in %s on line %d
bool(false)

Warning: SNMP::get() expects at least 1 parameter, 0 given in %s on line %d
bool(false)

Warning: SNMP::getnext() expects exactly 1 parameter, 0 given in %s on line %d
bool(false)

Warning: SNMP::set() expects exactly 3 parameters, 0 given in %s on line %d
bool(false)
NULL

Warning: main(): max_oids should be positive integer or NULL, got 0 in %s on line %d

Warning: main(): max_oids should be positive integer or NULL, got 0 in %s on line %d
NULL

Output

SNMP::__construct() expects at least 3 parameters, 2 given
SNMP::__construct() expects parameter 4 to be int, string given
SNMP::__construct() expects parameter 5 to be int, string given
Unknown SNMP protocol version
Exception handling

Warning: SNMP::get(): Invalid object identifier: .1.3.6.1.2.1.1.1..0 in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-error.php on line 32
bool(false)
int(32)
string(46) "Invalid object identifier: .1.3.6.1.2.1.1.1..0"
bool(true)
Open normal session

Warning: main(): Unknown SNMP value retrieval method '67' in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-error.php on line 48
int(1)
Closing session

Fatal error: Uncaught ArgumentCountError: SNMP::close() expects exactly 0 parameters, 1 given in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-error.php:51
Stack trace:
#0 /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-error.php(51): SNMP->close('')
#1 {main}
  thrown in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-error.php on line 51

Diff

018+ Fatal error: Uncaught ArgumentCountError: SNMP::close() expects exactly 0 parameters, 1 given in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-error.php:51
019+ Stack trace:
020+ #0 /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-error.php(51): SNMP->close('')
021+ #1 {main}
022+   thrown in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-error.php on line 51
018- Warning: SNMP::close() expects exactly 0 parameters, 1 given in %s on line %d
019- bool(false)
020- bool(true)
021- 
022- Warning: SNMP::get(): Invalid or uninitialized SNMP object in %s on line %d
023- bool(false)
024- bool(true)
025- 
026- Warning: SNMP::walk() expects parameter 3 to be int, string given in %s on line %d
027- bool(false)
028- 
029- Warning: SNMP::walk() expects parameter 4 to be int, string given in %s on line %d
030- bool(false)
031- 
032- Warning: SNMP::get() expects at least 1 parameter, 0 given in %s on line %d
033- bool(false)
034- 
035- Warning: SNMP::getnext() expects exactly 1 parameter, 0 given in %s on line %d
036- bool(false)
037- 
038- Warning: SNMP::set() expects exactly 3 parameters, 0 given in %s on line %d
039- bool(false)
040- NULL
041- 
042- Warning: main(): max_oids should be positive integer or NULL, got 0 in %s on line %d
043- 
044- Warning: main(): max_oids should be positive integer or NULL, got 0 in %s on line %d
045- NULL

 

Generated at Mon, 06 May 2019 17:58:35 +0000 (942 days ago)

Copyright © 2005-2021 The PHP Group
All rights reserved.