From d364765916f07b3d47eb6704b1af06e751454c13 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 5 Apr 2018 15:09:55 +0200 Subject: [locationinfo] Fix default setting for "select" backend options --- modules-available/locationinfo/inc/coursebackend.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules-available/locationinfo/inc/coursebackend.inc.php') diff --git a/modules-available/locationinfo/inc/coursebackend.inc.php b/modules-available/locationinfo/inc/coursebackend.inc.php index 7162c885..1da0086a 100644 --- a/modules-available/locationinfo/inc/coursebackend.inc.php +++ b/modules-available/locationinfo/inc/coursebackend.inc.php @@ -370,6 +370,9 @@ class BackendProperty { * @param mixed $current current value of this property. */ public function initForRender($current = null) { + if ($current === null) { + $current = $this->default; + } if (is_array($this->type)) { $this->template = 'dropdown'; $this->select_list = []; @@ -391,7 +394,7 @@ class BackendProperty { } elseif ($this->type === 'password') { $this->inputtype = Property::getPasswordFieldType(); } - $this->currentvalue = $current === null ? $this->default : $current; + $this->currentvalue = $current; } public $inputtype; public $template; -- cgit v1.2.3-55-g7522 From 533a2964535bcae48eb30ded2edaa6dd6d2c321b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 29 Jan 2019 09:20:55 +0100 Subject: [locationinfo] Suppress XML parsing error spam The SimpleXML constructor is quite verbose if you pass it e.g. an HTML error page instead of the expected XML. Suppress those errors, we'll do our own (more concise) logging in the exception handler. --- modules-available/locationinfo/inc/coursebackend.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules-available/locationinfo/inc/coursebackend.inc.php') diff --git a/modules-available/locationinfo/inc/coursebackend.inc.php b/modules-available/locationinfo/inc/coursebackend.inc.php index 1da0086a..dcd92f6f 100644 --- a/modules-available/locationinfo/inc/coursebackend.inc.php +++ b/modules-available/locationinfo/inc/coursebackend.inc.php @@ -334,7 +334,7 @@ abstract class CourseBackend { $cleanresponse = preg_replace('/(<\/?)(\w+):([^>]*>)/', '$1$2$3', $response); try { - $xml = new SimpleXMLElement($cleanresponse); + $xml = @new SimpleXMLElement($cleanresponse); // This spams before throwing exception } catch (Exception $e) { $this->error = 'Could not parse reply as XML, got ' . get_class($e) . ': ' . $e->getMessage(); if (CONFIG_DEBUG) { -- cgit v1.2.3-55-g7522