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-setSecurity_error.phpt ('OO API: SNMP::setSecurity (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:
$session = new SNMP(SNMP::VERSION_3$hostname$user_noauth$timeout$retries);
9:
$session->setSecurity('noAuthNoPriv');
10:
11:
#echo "Checking error handling\n";
12:
var_dump($session->setSecurity());
13:
var_dump($session->setSecurity(''));
14:
var_dump($session->setSecurity('bugusPriv'));
15:
var_dump($session->setSecurity('authNoPriv''TTT'));
16:
var_dump($session->setSecurity('authNoPriv''MD5'''));
17:
var_dump($session->setSecurity('authNoPriv''MD5''te'));
18:
var_dump($session->setSecurity('authPriv''MD5'$auth_pass'BBB'));
19:
var_dump($session->setSecurity('authPriv''MD5'$auth_pass'AES'''));
20:
var_dump($session->setSecurity('authPriv''MD5'$auth_pass'AES''ty'));
21:
var_dump($session->setSecurity('authPriv''MD5'$auth_pass'AES''test12345''context''dsa'));
22:
23:
var_dump($session->close());
24:
25:
?>
26:

Expected

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

Warning: SNMP::setSecurity(): Invalid security level '' in %s on line %d
bool(false)

Warning: SNMP::setSecurity(): Invalid security level 'bugusPriv' in %s on line %d
bool(false)

Warning: SNMP::setSecurity(): Unknown authentication protocol 'TTT' in %s on line %d
bool(false)

Warning: SNMP::setSecurity(): Error generating a key for authentication pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d
bool(false)

Warning: SNMP::setSecurity(): Error generating a key for authentication pass phrase 'te': Generic error (The supplied password length is too short.) in %s on line %d
bool(false)

Warning: SNMP::setSecurity(): Unknown security protocol 'BBB' in %s on line %d
bool(false)

Warning: SNMP::setSecurity(): Error generating a key for privacy pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d
bool(false)

Warning: SNMP::setSecurity(): Error generating a key for privacy pass phrase 'ty': Generic error (The supplied password length is too short.) in %s on line %d
bool(false)

Warning: SNMP::setSecurity(): Bad engine ID value 'dsa' in %s on line %d
bool(false)
bool(true)

Output

Fatal error: Uncaught ArgumentCountError: SNMP::setSecurity() expects at least 1 parameter, 0 given in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-setSecurity_error.php:12
Stack trace:
#0 /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-setSecurity_error.php(12): SNMP->setSecurity()
#1 {main}
  thrown in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-setSecurity_error.php on line 12

Diff

001+ Fatal error: Uncaught ArgumentCountError: SNMP::setSecurity() expects at least 1 parameter, 0 given in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-setSecurity_error.php:12
002+ Stack trace:
003+ #0 /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-setSecurity_error.php(12): SNMP->setSecurity()
004+ #1 {main}
005+   thrown in /var/php_gcov/PHP_HEAD/ext/snmp/tests/snmp-object-setSecurity_error.php on line 12
001- Warning: SNMP::setSecurity() expects at least 1 parameter, 0 given in %s on line %d
002- bool(false)
003- 
004- Warning: SNMP::setSecurity(): Invalid security level '' in %s on line %d
005- bool(false)
006- 
007- Warning: SNMP::setSecurity(): Invalid security level 'bugusPriv' in %s on line %d
008- bool(false)
009- 
010- Warning: SNMP::setSecurity(): Unknown authentication protocol 'TTT' in %s on line %d
011- bool(false)
012- 
013- Warning: SNMP::setSecurity(): Error generating a key for authentication pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d
014- bool(false)
015- 
016- Warning: SNMP::setSecurity(): Error generating a key for authentication pass phrase 'te': Generic error (The supplied password length is too short.) in %s on line %d
017- bool(false)
018- 
019- Warning: SNMP::setSecurity(): Unknown security protocol 'BBB' in %s on line %d
020- bool(false)
021- 
022- Warning: SNMP::setSecurity(): Error generating a key for privacy pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d
023- bool(false)
024- 
025- Warning: SNMP::setSecurity(): Error generating a key for privacy pass phrase 'ty': Generic error (The supplied password length is too short.) in %s on line %d
026- bool(false)
027- 
028- Warning: SNMP::setSecurity(): Bad engine ID value 'dsa' in %s on line %d
029- bool(false)
030- bool(true)

 

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

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