changeStatus error in production with custom `num` option in blueprint?

I’m using a blueprint that has an option num as follows:

num: '{{ page.publication_date.toDate("Ymd") }}'

In my local dev environment, this works perfectly when I change the status of a page to “listed”; a prefix (e.g. “20231023_”) is added to the folder as expected.

However, when I do this on the production server, I’m getting following error in the panel:

Error: array_merge(): Argument #2 must be of type array, bool given

Any idea what this is and how I can solve it?

Is there a stack trace somewhere in the PHP error logs?

Is the PHP version the same on local and remote?

  1. This error doesn’t appear in error log.
  2. Both envs are on PHP 8.1 (not exactly the same minor version though) - and both are on Kirby 3.9.7

Screenshot of error in panel:

Screenshot of error in console:

FYI: changing the status of that page to Unlisted works perfectly. This made me believe it has something to do with the num option in the page’s blueprint. When disabling the num option in the blueprint, I’m able to make that page “Listed”, but I need it to be sorted via the publication_date field.

Maybe different date handlers intl vs strftime or no proper defined/working date handler at all on the server?

Does something like this work in a php template?

<?= $page->publication_date()->toDate("Ymd") ?>

Hi @lukaskleinschmidt , thx for chiming in!

Yes, that works as expected.

Are you able to “manually” change the status?

$page->changeStatus('listed');

@lukaskleinschmidt , thanks for the direction. I’ve tested and found where that error originated from:

This second argument in array_merge is no array, but a boolean?

I’ve found a way to make it dissapear, but I don’t why nor does it allow me to fix my issue:
In config.php I include routes like this:

'routes' => require_once __DIR__ . '/routes.php',

replacing that by

'routes' => [],

allows me to changeStatus of that page…

But I don’t get why that happens?

require_once returns true when it already read the file before.
Kirby for some reason reads that config twice probably, and the second time it doesn’t get the route but just a true. You would probably want to replace that with a normal require or include.

1 Like

Wow, this indeed seems to fix it Roman!

I do wonder why config.php gets loaded twice… :thinking:
But changing all require_once to require inside config.pbp doesn’t seem to have side effects and seem to fix this issue.

Thx everyone!

Out of the box (like in a fresh 3.9.7 plainkit), it’s actually loaded only 1 time. I don’t know why yours is loaded twice.

Edit: maybe you include the file in 2 different config files? Like once in config.php and once in config.example.org.php?