From 26464651c8bdc2a6ef42c81199c8b7c10dc215ea Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 4 Jul 2019 13:24:31 +0200 Subject: [PATCH 1/2] Changed from XML::Parser to XML::SAX::ExpatXS --- pandora_server/lib/PandoraFMS/Core.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 1c8fa4c784..e9fa4e4038 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -130,7 +130,7 @@ use Text::ParseWords; # due a bug processing some XML with blank spaces. # See http://www.perlmonks.org/?node_id=706838 -$XML::Simple::PREFERRED_PARSER='XML::Parser'; +$XML::Simple::PREFERRED_PARSER='XML::SAX::ExpatXS'; # Default lib dir for RPM and DEB packages use lib '/usr/lib/perl5'; From 380574b86307cab525b33a4ad58d8b4125b4f562 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 30 Jul 2019 19:46:16 +0200 Subject: [PATCH 2/2] Ondemand based on environment XML parser --- pandora_server/lib/PandoraFMS/Core.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index aba6c908c5..f042542420 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -130,7 +130,16 @@ use Text::ParseWords; # due a bug processing some XML with blank spaces. # See http://www.perlmonks.org/?node_id=706838 -$XML::Simple::PREFERRED_PARSER='XML::SAX::ExpatXS'; +eval { + local $SIG{__DIE__}; + eval "use XML::SAX::ExpatXS;1" or die "XML::SAX::ExpatXS not available"; +}; +if (!$@) { + # Force best option available. + $XML::Simple::PREFERRED_PARSER='XML::SAX::ExpatXS'; +} else { + # Let ParserDetails.ini command parser. +} # Default lib dir for RPM and DEB packages use lib '/usr/lib/perl5';