Commit b21fa700 authored by Sam Lerner's avatar Sam Lerner Committed by Matthew Radcliffe
Browse files

Issue #3276506 by SamLerner, Splushka, hmendes: Fixes pass by reference in array_reduce backport

parent a74efe93
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ class AgreementHandler implements AgreementHandlerInterface {
    ];

    // Get a list of pages to never display agreements on.
    $exceptions = array_reduce($agreement_types, function (&$result, Agreement $item) {
    $exceptions = array_reduce($agreement_types, function ($result, Agreement $item) {
      $result[] = $item->get('path');
      return $result;
    }, $default_exceptions);
@@ -162,7 +162,7 @@ class AgreementHandler implements AgreementHandlerInterface {
    }

    // Reduce the agreement types based on the user role.
    $agreements_with_roles = array_reduce($agreement_types, function (&$result, Agreement $item) use ($account) {
    $agreements_with_roles = array_reduce($agreement_types, function ($result, Agreement $item) use ($account) {
      if ($item->accountHasAgreementRole($account)) {
        $result[] = $item;
      }
@@ -172,7 +172,7 @@ class AgreementHandler implements AgreementHandlerInterface {
    // Try to find an agreement type that matches the path.
    $pathMatcher = $this->pathMatcher;
    $self = $this;
    $info = array_reduce($agreements_with_roles, function (&$result, Agreement $item) use ($account, $path, $pathMatcher, $self) {
    $info = array_reduce($agreements_with_roles, function ($result, Agreement $item) use ($account, $path, $pathMatcher, $self) {
      if ($result) {
        // Always returns the first matched agreement.
        return $result;