Skip to content

Commit

Permalink
Convert string errors into array
Browse files Browse the repository at this point in the history
This make sure that externally defined error are properly formatted to
be included in the event xml.
  • Loading branch information
nitriques committed Oct 18, 2017
1 parent c918586 commit d36b2a7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/class.members.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ public function appendLoginStatusToEventXML(array $context = null){
// Append error messages
if(is_array(extension_Members::$_errors) && !empty(extension_Members::$_errors)) {
foreach(extension_Members::$_errors as $type => $error) {
if (!is_array($error)) {
$error = array(
'label' => $type,
'type' => 'error',
'message' => General::sanitize((string)$error),
'message-id' => MemberEventMessages::MEMBER_ERRORS,
);
}
$result->appendChild(
new XMLElement($type, null, array(
'label' => General::sanitize($error['label']),
Expand Down

0 comments on commit d36b2a7

Please sign in to comment.