wagnerwagner / merx

Merx is a plugin to create online shops with Kirby.
https://merx.wagnerwagner.de
104 stars 10 forks source link

Kirby 3.4: TypeError when initializing cart #11

Closed bezin closed 4 years ago

bezin commented 4 years ago

Hi there,

we develop a shop with Merx and when we initialize a cart, we get the following TypeError.

TypeError
Argument 2 passed to Kirby\Cms\App::trigger() must be of the type array, object given, called in C:\dev\project_root\site\plugins\merx\src\cart.php on line 22

This was introduced in #1; The kirby()->trigger() method expects an array rather than an object. I guess the purpose was to pass $data to allow for calculations based on the cart content? Otherwise, one could pass an array like ['cart' => $this]

This is due to the method signature change to kirby()->trigger() in the latest Kirby 3.4.0 release.

I am happy to provide more information.

Cheers

bezin commented 4 years ago

See latest release notes for further information.

Basically the new method signature does not expect multiple arguments, but an associative array:

// Kirby/Cms/App.php:1399
public function trigger(string $name, array $args = [], ?Event $originalEvent = null)
tobiasfabian commented 4 years ago

Thanks for your issue.

This should be fixed with version 1.4.0-rc.1

bezin commented 4 years ago

Looking good so far, thanks for your quick reaction 👍