Argument 1 passed to Kirby\Cms\App::extendHooks() must be of the type array, bool given, called in /vagrant/vendor/getkirby/cms/src/Cms/AppPlugins.php on line 99

Hey there,
I wanted to update a page, so I did this:

$updateArray = [
    'participants' => 'John Doe'

$updatedPage = $page->update($updateArray);

… but it gives mentioned error - quite lost, since this worked some minor versions ago pretty well :confused:

Where are you doing this? Looks like you are registering an extension somewhere, but with incorrect syntax…

For now, in an ordinary template file - originally inside a hook.

Is that hook still registered somewhere? How, where?

I found and disabled the hook in question, now it just spits out array_merge(): Expected parameter 2 to be an array, bool given, leading to the code I posted above.

See this function:

    protected function extendRoutes($routes): array
        if (is_a($routes, 'Closure') === true) {
            $routes = $routes($this);
        return $this->extensions['routes'] = array_merge($this->extensions['routes'], $routes);

Ok, do you have any routes registered? Maybe in a separate file called from inside a plugin/the config? If so, what is in the config/plugin?

Well, aren’t you the best - commenting my routing file include yields this:

Undefined variable: page

Seems to lead further down a rabbit hole, … as this applied to $page and $site calls on all my snippets (?) - I’ll investigate later -_-

OMG - I forgot that my multi-language setup needs to be taken into account: $page->update($updateArray, 'de'); seems to fix it for good

I would have expected this to work without the language param, so that default language would be updated if no particular language is given… :thinking:

I had the same problem. In my case the issue was the configuration of routes in the config.php.

I had 'routes' => require_once __DIR__ . '/options/routes.php', which led to the error mentioned in the title, as soon as the number of a page changed (e.g. sorting or publishing a page). Changing require_once to require solves the issue.

// config.php
'routes' => require __DIR__ . '/options/routes.php',