Merge pull request #3704 from Icinga/bugfix/br-in-plugin-output-3662

Preserve <br>s in plugin output

(cherry picked from commit 33f7d0b8e6)
Signed-off-by: Johannes Meyer <johannes.meyer@icinga.com>
This commit is contained in:
Johannes Meyer 2019-04-11 14:31:38 +02:00
parent 811f10953b
commit dd1fd2eb71
2 changed files with 4 additions and 7 deletions

View File

@ -102,7 +102,6 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract
if ($command !== null) {
$output = $this->hookRenderer->render($command, $output, ! $raw);
}
$output = preg_replace('~<br[^>]*>~', "\n", $output);
if (preg_match('~<[^>]*["/\'][^>]*>~', $output)) {
// HTML
$output = preg_replace(

View File

@ -87,16 +87,14 @@ class PluginOutputTest extends BaseTestCase
{
$input = array(
'Teststatus',
'<a href="http://localhost/test.php" target="_blank">Info</a><br/><br/>',
'<a href="http://localhost/test2.php" target="_blank">Info2</a>'
'<a href="http://localhost/test.php" target="_blank">Info</a><br/><br/>'
. '<a href="http://localhost/test2.php" target="_blank">Info2</a>'
);
/** @noinspection HtmlUnknownAttribute */
$output = array(
'Teststatus',
'<a href="http://localhost/test.php" target="_blank"[^>]*>Info</a>',
'',
'',
'<a href="http://localhost/test2.php" target="_blank"[^>]*>Info2</a>'
'<a href="http://localhost/test.php" target="_blank"[^>]*>Info</a><br><br>'
. '<a href="http://localhost/test2.php" target="_blank"[^>]*>Info2</a>'
);
$this->checkHtmlOutput(
join("\n", $input),