Skip to content

Commit

Permalink
Prevent undefined index warning
Browse files Browse the repository at this point in the history
Usign array_pad makes sure we will be deconstructing the array without
any undefined indexes
  • Loading branch information
nitriques committed Oct 6, 2017
1 parent 3996572 commit be4f8df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/class.membersevent.php
Expand Up @@ -100,7 +100,7 @@ protected function notifyEventPreSaveFilter(XMLElement &$result, array $fields,
$can_proceed = true;

foreach ($this->filter_results as $fr) {
list($name, $status, $message, $attributes) = $fr;
list($name, $status, $message, $attributes) = array_pad($fr, 4, null);

$result->appendChild(
MembersEvent::buildFilterElement($name, ($status ? 'passed' : 'failed'), $message, $attributes)
Expand Down Expand Up @@ -146,7 +146,7 @@ protected function notifyEventFinalSaveFilter(XMLElement &$result, array $fields
// Take the logic from `event.section.php` to append `$this->filter_errors`
if(is_array($this->filter_errors) && !empty($this->filter_errors)){
foreach($this->filter_errors as $fr){
list($name, $status, $message, $attributes) = $fr;
list($name, $status, $message, $attributes) = array_pad($fr, 4, null);

$result->appendChild(
MembersEvent::buildFilterElement($name, ($status ? 'passed' : 'failed'), $message, $attributes)
Expand Down

0 comments on commit be4f8df

Please sign in to comment.