mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Escape net-snmp unformatted strings, try 2 (#13584)
* Escape net-snmp unformatted strings, try 2 * Add some tests
This commit is contained in:
@@ -47,6 +47,13 @@ class SnmpResponseTest extends TestCase
|
||||
$this->assertEquals(['' => 'IF-MIB::ifDescr'], $response->values());
|
||||
$this->assertEquals('IF-MIB::ifDescr', $response->value());
|
||||
$this->assertEquals(['IF-MIB::ifDescr'], $response->table());
|
||||
|
||||
// unescaped strings
|
||||
$response = new SnmpResponse("Q-BRIDGE-MIB::dot1qVlanStaticName[1] = \"default\"\nQ-BRIDGE-MIB::dot1qVlanStaticName[9] = \"\\\\Surrounded\\\\\"");
|
||||
$this->assertTrue($response->isValid());
|
||||
$this->assertEquals('default', $response->value());
|
||||
$this->assertEquals(['Q-BRIDGE-MIB::dot1qVlanStaticName[1]' => 'default', 'Q-BRIDGE-MIB::dot1qVlanStaticName[9]' => '\\Surrounded\\'], $response->values());
|
||||
$this->assertEquals(['Q-BRIDGE-MIB::dot1qVlanStaticName' => [1 => 'default', 9 => '\\Surrounded\\']], $response->table());
|
||||
}
|
||||
|
||||
public function testMultiLine(): void
|
||||
|
Reference in New Issue
Block a user