"Undefined index: URL" when trying to publish page

I don’t know if I screwed up one of my blueprints or some model. But maybe someone can tell what the following error means and how I debug it.

I recently, when I try to change the status of a specific type of pages (one that doesn’t have sorting), I get the following error (saving alone works fine as long as the page isn’t published):

Screenshot from 2021-10-27 19-42-09

That’s the server response:

{"$dialog":{"code":500,"error":"Undefined index: URL","path":"dialogs\/pages\/blog+rene-s-test-artikel\/changeStatus","referrer":"\/pages\/blog+rene-s-test-artikel"}}

“Index: URL” doesn’t ring any bells for me. And there is not really more information to it.

It also only happens on a specific remote server, so It can be that the error depends on how the content is currently structured in the content folder.

Has anyone deeper knowledge where this error comes from and how I’m gonna debug, so I can find out, what I did wrong?

It’s Kirby 3.6.0-rc.2, but it also happened on 3.6.0-rc.1. Can’t tell if it happened on earlier version because my code might not be the same.

Is this error related only to pages with a model? If so, could you post the code?

Undefined index: URL means that there is somewhere a call to $somearray['url'] without a check if this index exists.

Voilà, that already helped. I have an URL setter in my config, that loads it from the .env file if it exists.

'url' => $_ENV['URL'] ? $_ENV['URL'] : null,

Removing it (or probably changing to isset()) resolves the issue.

Even though I have a check here and that worked perfectly fine for every website over a year, this might have something to do with the different PHP version or config on the remote server, as the error doesn’t occur locally and on my staging server. Also, assuming PHP 8 will require an explicit isset(), it has most likely something to do with the environment the website is running in.

Why the error only appears on one specific type of pages and not on all, is not obvious to me and probably is the reason I wouldn’t really have come up with the idea, that this could be related to the config.

Thanks, once again, Sonja. :slight_smile:


'url' => $_ENV['URL'] ?? : null,


'url' => isset($_ENV['URL']) ? $_ENV['URL'] : null,

would be correct.

Thank you. Seems like I still stuck in JavaScript syntax when I try to write PHP.