verbb / workflow

A Craft CMS plugin to create a workflow for publishing entries.
Other
140 stars 27 forks source link

Cannot access submission - Error array_sum(): Addition is not supported on type array #211

Open jlachancekffein opened 1 month ago

jlachancekffein commented 1 month ago

Describe the bug

When I try to access the details of a submission via the submission listing, an error is triggered: array_sum(): Addition is not supported on type array.

The issue seems to be here: src/craftCMS/vendor/verbb/workflow/src/services/Content.php

private function _arrayMultisum(array $arr): float
{

    $sum = array_sum($arr);

    foreach ($arr as $child) {
        $sum += is_array($child) ? $this->_arrayMultisum($child) : 0;
    }

    return $sum;
}

When I dump $arr, the value is a nested array of one level, which triggers the error. Here's the dump of the variable:

array:1 [▼
  0 => array:1 [▼
    "add" => 2
  ]
]

Steps to reproduce

  1. Click on an item on the submission listing

Craft CMS version

5.1.5

Plugin version

dev-craft-5 as 3.0.0-beta.1

Multi-site?

Yes

Additional context

No response

engram-design commented 1 month ago

Fixed for the next release. To get this early, run composer require verbb/workflow:"dev-craft-5 as 3.0.0".