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/snmp2_set.phpt ('Function snmp2_set')

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: echo 
"Check error handing\n";
9: echo 
"4args (5 needed)\n";
10:
$z snmp2_set($hostname$communityWrite'SNMPv2-MIB::sysLocation.0');
11:
var_dump($z);
12:
13: echo 
"No type & no value (timeout & retries instead)\n";
14:
$z snmp2_set($hostname$communityWrite'SNMPv2-MIB::sysLocation.0'$timeout$retries);
15:
var_dump($z);
16:
17: echo 
"No value (timeout instead), retries instead of timeout\n";
18:
$z snmp2_set($hostname$communityWrite'SNMPv2-MIB::sysLocation.0''q'$timeout$retries);
19:
var_dump($z);
20:
21: echo 
"Bogus OID\n";
22:
$z snmp2_set($hostname$communityWrite'.1.3.6.777.888.999.444.0''s''bbb'$timeout$retries);
23:
var_dump($z);
24:
25: echo 
"Checking working\n";
26:
$oid1 'SNMPv2-MIB::sysContact.0';
27:
$oldvalue1 snmpget($hostname$communityWrite$oid1$timeout$retries);
28:
$newvalue1 $oldvalue1 '0';
29:
$oid2 'SNMPv2-MIB::sysLocation.0';
30:
$oldvalue2 snmpget($hostname$communityWrite$oid1$timeout$retries);
31:
$newvalue2 $oldvalue2 '0';
32:
33: echo 
"Single OID\n";
34:
$z snmp2_set($hostname$communityWrite$oid1's'$newvalue1$timeout$retries);
35:
var_dump($z);
36:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $newvalue1));
37:
$z snmp2_set($hostname$communityWrite$oid1's'$oldvalue1$timeout$retries);
38:
var_dump($z);
39:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
40:
41: echo 
"Multiple OID\n";
42:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('s','s'), array($newvalue1$newvalue2), $timeout$retries);
43:
var_dump($z);
44:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $newvalue1));
45:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $newvalue2));
46:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('s','s'), array($oldvalue1$oldvalue2), $timeout$retries);
47:
var_dump($z);
48:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
49:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
50:
51: echo 
"Multiple OID, single type & value\n";
52:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), 's'$newvalue1$timeout$retries);
53:
var_dump($z);
54:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $newvalue1));
55:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $newvalue1));
56:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('s','s'), array($oldvalue1$oldvalue2), $timeout$retries);
57:
var_dump($z);
58:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
59:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
60:
61: echo 
"Multiple OID, single type, multiple value\n";
62:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), 's', array($newvalue1$newvalue2), $timeout$retries);
63:
var_dump($z);
64:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $newvalue1));
65:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $newvalue2));
66:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('s','s'), array($oldvalue1$oldvalue2), $timeout$retries);
67:
var_dump($z);
68:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
69:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
70:
71:
72: echo 
"More error handing\n";
73: echo 
"Single OID, single type in array, single value\n";
74:
$z snmp2_set($hostname$communityWrite$oid1, array('s'), $newvalue1$timeout$retries);
75:
var_dump($z);
76:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
77:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
78:
79: echo 
"Single OID, single type, single value in array\n";
80:
$z snmp2_set($hostname$communityWrite$oid1's', array($newvalue1), $timeout$retries);
81:
var_dump($z);
82:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
83:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
84:
85: echo 
"Multiple OID, 1st wrong type\n";
86:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('sw','s'), array($newvalue1$newvalue2), $timeout$retries);
87:
var_dump($z);
88:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
89:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
90:
91: echo 
"Multiple OID, 2nd wrong type\n";
92:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('s','sb'), array($newvalue1$newvalue2), $timeout$retries);
93:
var_dump($z);
94:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
95:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
96:
97: echo 
"Multiple OID, single type in array, multiple value\n";
98:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('s'), array($newvalue1$newvalue2), $timeout$retries);
99:
var_dump($z);
100:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
101:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
102:
103: echo 
"Multiple OID & type, singe value in array\n";
104:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('s''s'), array($newvalue1), $timeout$retries);
105:
var_dump($z);
106:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
107:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
108:
109: echo 
"Multiple OID, 1st bogus, single type, multiple value\n";
110:
$z snmp2_set($hostname$communityWrite, array($oid1 '44.55.66.77'$oid2), 's', array($newvalue1$newvalue2), $timeout$retries);
111:
var_dump($z);
112:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
113:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
114:
115: echo 
"Multiple OID, 2nd bogus, single type, multiple value\n";
116:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2 '44.55.66.77'), 's', array($newvalue1$newvalue2), $timeout$retries);
117:
var_dump($z);
118:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
119:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
120:
121: echo 
"Multiple OID, single multiple type (1st bogus), multiple value\n";
122:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('q''s'), array($newvalue1$newvalue2), $timeout$retries);
123:
var_dump($z);
124:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
125:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
126:
127: echo 
"Multiple OID, single multiple type (2nd bogus), multiple value\n";
128:
$z snmp2_set($hostname$communityWrite, array($oid1$oid2), array('s''w'), array($newvalue1$newvalue2), $timeout$retries);
129:
var_dump($z);
130:
var_dump((snmpget($hostname$communityWrite$oid1$timeout$retries) === $oldvalue1));
131:
var_dump((snmpget($hostname$communityWrite$oid2$timeout$retries) === $oldvalue2));
132:
133:
?>
134:

Expected

Check error handing
4args (5 needed)

Warning: snmp2_set() expects at least 5 parameters, 3 given in %s on line %d
bool(false)
No type & no value (timeout & retries instead)

Warning: snmp2_set(): Bogus type '-1', should be single char, got 2 in %s on line %d
bool(false)
No value (timeout instead), retries instead of timeout

Warning: snmp2_set(): Could not add variable: OID='%s' type='q' value='%i': Bad variable type ("q") in %s on line %d
bool(false)
Bogus OID

Warning: snmp2_set(): Error in packet at '%s': notWritable (That object does not support modification) in %s on line %d
bool(false)
Checking working
Single OID
bool(true)
bool(true)
bool(true)
bool(true)
Multiple OID
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
Multiple OID, single type & value
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
Multiple OID, single type, multiple value
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
More error handing
Single OID, single type in array, single value

Warning: snmp2_set(): Single objid and multiple type or values are not supported in %s on line %d
bool(false)
bool(true)
bool(true)
Single OID, single type, single value in array

Warning: snmp2_set(): Single objid and multiple type or values are not supported in %s on line %d
bool(false)
bool(true)
bool(true)
Multiple OID, 1st wrong type

Warning: snmp2_set(): '%s': bogus type 'sw', should be single char, got 2 in %s on line %d
bool(false)
bool(true)
bool(true)
Multiple OID, 2nd wrong type

Warning: snmp2_set(): '%s': bogus type 'sb', should be single char, got 2 in %s on line %d
bool(false)
bool(true)
bool(true)
Multiple OID, single type in array, multiple value

Warning: snmp2_set(): '%s': no type set in %s on line %d
bool(false)
bool(true)
bool(true)
Multiple OID & type, singe value in array

Warning: snmp2_set(): '%s': no value set in %s on line %d
bool(false)
bool(true)
bool(true)
Multiple OID, 1st bogus, single type, multiple value

Warning: snmp2_set(): Error in packet at '%s': %rnoCreation|notWritable%r (%s) in %s on line %d
bool(false)
bool(true)
bool(true)
Multiple OID, 2nd bogus, single type, multiple value

Warning: snmp2_set(): Error in packet at '%s': %rnoCreation|notWritable%r (%s) in %s on line %d
bool(false)
bool(true)
bool(true)
Multiple OID, single multiple type (1st bogus), multiple value

Warning: snmp2_set(): Could not add variable: OID='%s' type='q' value='%s': Bad variable type ("q") in %s on line %d
bool(false)
bool(true)
bool(true)
Multiple OID, single multiple type (2nd bogus), multiple value

Warning: snmp2_set(): Could not add variable: OID='%s' type='w' value='%s': Bad variable type ("w") in %s on line %d
bool(false)
bool(true)
bool(true)

Output

Check error handing
4args (5 needed)

Fatal error: Uncaught ArgumentCountError: snmp2_set() expects at least 5 parameters, 3 given in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp2_set.php:10
Stack trace:
#0 /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp2_set.php(10): snmp2_set('127.0.0.1:161', 'private', 'SNMPv2-MIB::sys...')
#1 {main}
  thrown in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp2_set.php on line 10

Diff

004+ Fatal error: Uncaught ArgumentCountError: snmp2_set() expects at least 5 parameters, 3 given in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp2_set.php:10
005+ Stack trace:
006+ #0 /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp2_set.php(10): snmp2_set('127.0.0.1:161', 'private', 'SNMPv2-MIB::sys...')
007+ #1 {main}
008+   thrown in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp2_set.php on line 10
004- Warning: snmp2_set() expects at least 5 parameters, 3 given in %s on line %d
005- bool(false)
006- No type & no value (timeout & retries instead)
007- 
008- Warning: snmp2_set(): Bogus type '-1', should be single char, got 2 in %s on line %d
009- bool(false)
010- No value (timeout instead), retries instead of timeout
011- 
012- Warning: snmp2_set(): Could not add variable: OID='%s' type='q' value='%i': Bad variable type ("q") in %s on line %d
013- bool(false)
014- Bogus OID
015- 
016- Warning: snmp2_set(): Error in packet at '%s': notWritable (That object does not support modification) in %s on line %d
017- bool(false)
018- Checking working
019- Single OID
020- bool(true)
021- bool(true)
022- bool(true)
023- bool(true)
024- Multiple OID
025- bool(true)
026- bool(true)
027- bool(true)
028- bool(true)
029- bool(true)
030- bool(true)
031- Multiple OID, single type & value
032- bool(true)
033- bool(true)
034- bool(true)
035- bool(true)
036- bool(true)
037- bool(true)
038- Multiple OID, single type, multiple value
039- bool(true)
040- bool(true)
041- bool(true)
042- bool(true)
043- bool(true)
044- bool(true)
045- More error handing
046- Single OID, single type in array, single value
047- 
048- Warning: snmp2_set(): Single objid and multiple type or values are not supported in %s on line %d
049- bool(false)
050- bool(true)
051- bool(true)
052- Single OID, single type, single value in array
053- 
054- Warning: snmp2_set(): Single objid and multiple type or values are not supported in %s on line %d
055- bool(false)
056- bool(true)
057- bool(true)
058- Multiple OID, 1st wrong type
059- 
060- Warning: snmp2_set(): '%s': bogus type 'sw', should be single char, got 2 in %s on line %d
061- bool(false)
062- bool(true)
063- bool(true)
064- Multiple OID, 2nd wrong type
065- 
066- Warning: snmp2_set(): '%s': bogus type 'sb', should be single char, got 2 in %s on line %d
067- bool(false)
068- bool(true)
069- bool(true)
070- Multiple OID, single type in array, multiple value
071- 
072- Warning: snmp2_set(): '%s': no type set in %s on line %d
073- bool(false)
074- bool(true)
075- bool(true)
076- Multiple OID & type, singe value in array
077- 
078- Warning: snmp2_set(): '%s': no value set in %s on line %d
079- bool(false)
080- bool(true)
081- bool(true)
082- Multiple OID, 1st bogus, single type, multiple value
083- 
084- Warning: snmp2_set(): Error in packet at '%s': %rnoCreation|notWritable%r (%s) in %s on line %d
085- bool(false)
086- bool(true)
087- bool(true)
088- Multiple OID, 2nd bogus, single type, multiple value
089- 
090- Warning: snmp2_set(): Error in packet at '%s': %rnoCreation|notWritable%r (%s) in %s on line %d
091- bool(false)
092- bool(true)
093- bool(true)
094- Multiple OID, single multiple type (1st bogus), multiple value
095- 
096- Warning: snmp2_set(): Could not add variable: OID='%s' type='q' value='%s': Bad variable type ("q") in %s on line %d
097- bool(false)
098- bool(true)
099- bool(true)
100- Multiple OID, single multiple type (2nd bogus), multiple value
101- 
102- Warning: snmp2_set(): Could not add variable: OID='%s' type='w' value='%s': Bad variable type ("w") in %s on line %d
103- bool(false)
104- bool(true)
105- bool(true)

 

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

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