Merge pull request #4317 from Icinga/fix/newlines-in-plugin-output-4297

Fix that subsequent escaped newlines are not transformed in plugin output
This commit is contained in:
Johannes Meyer 2021-02-15 11:34:32 +01:00 committed by GitHub
commit 712e74b3ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -16,9 +16,9 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract
* @var array
*/
protected static $txtPatterns = array(
'~\\\n~',
'~\\\n\\\n~',
'~\\\t~',
'~\\\n\\\n~',
'~\\\n~',
'~(\[|\()OK(\]|\))~',
'~(\[|\()WARNING(\]|\))~',
'~(\[|\()CRITICAL(\]|\))~',
@ -52,9 +52,9 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract
* @var array
*/
protected static $htmlPatterns = array(
'~\\\n~',
'~\\\t~',
'~\\\n\\\n~',
'~\\\t~',
'~\\\n~',
'~<table~'
);

View File

@ -65,6 +65,14 @@ class PluginOutputTest extends BaseTestCase
);
}
public function testOutputWithNewlines()
{
$this->checkOutput(
'foo\nbar\n\nraboof',
"foo\nbar\nraboof"
);
}
public function testOutputWithHtmlEntities()
{
$this->checkOutput(