From 4a801a9a8a1b321947035fb2ecd66dae112754c4 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Sun, 15 Mar 2015 20:12:39 +0100 Subject: [PATCH] issue in error handling Config load --- src/opnsense/mvc/app/library/OPNsense/Core/Config.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/opnsense/mvc/app/library/OPNsense/Core/Config.php b/src/opnsense/mvc/app/library/OPNsense/Core/Config.php index a0935f8f5..cff2339d0 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Core/Config.php +++ b/src/opnsense/mvc/app/library/OPNsense/Core/Config.php @@ -236,12 +236,17 @@ class Config extends Singleton set_error_handler( function() { - throw new ConfigException("invalid config xml") ; + // reset simplexml pointer on parse error. + $this->simplexml = null ; } ); $this->simplexml = simplexml_load_string($xml); + if ($this->simplexml == null) { + throw new ConfigException("invalid config xml") ; + } + restore_error_handler(); $this->statusIsValid = true; }