Skip to content

Commit

Permalink
fix infinite loop on massive actions (#12959)
Browse files Browse the repository at this point in the history
* fix retrieval of current massive action when redirecting after a too long delay

* fix getRemainings
  • Loading branch information
orthagh authored Oct 12, 2022
1 parent 454c9f4 commit 9f6bba5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/MassiveAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class MassiveAction
* Items remaining in current process.
* @var array
*/
private $remainings = [];
private $remainings = null;

/**
* Fields to remove after reload.
Expand Down Expand Up @@ -403,7 +403,9 @@ public function __construct(array $POST, array $GET, $stage, ?int $items_id = nu

// Add process elements
if ($stage == 'process') {
$this->remainings = $this->items;
if (!isset($this->remainings)) {
$this->remainings = $this->items;
}

$this->fields_to_remove_when_reload = ['fields_to_remove_when_reload'];

Expand Down Expand Up @@ -568,7 +570,7 @@ public function getItems()
**/
public function getRemainings()
{
return $this->remainings;
return $this->remainings ?? [];
}


Expand Down

0 comments on commit 9f6bba5

Please sign in to comment.