toPage() not working anymore after update

Hey guys,
I updated a website to version 3.53 and I have multiple issues since then.

Issue 1:
If I create a new page (regardless which template I use) and set its status to listed or unlisted all page objects generated from fields of type “pages” get overwritten by the newly created page in the frontend. Atleast when I use toPage() on them. As soon as I change the status back to draft everything works again as expected.
Multilanguage support is activated for the website.

Issue 2:
When I gave php 8 a try image-resizing/-cropping/-blur did not work anymore. On php 7.4 everything works fine.

I hope somebody has a solution for atleast the first issue.

Greetings
Jens

Could you please provide a few more details? Like how do you create these new pages (via the Panel, programmatically).

What does actually get stored in these pages fields in your content files?

And maybe post the code you use in your template that doesn’t work. If I understand correctly, all fields of type pages when converted to a page object with toPage() return the newly created page instead of the page that is actually stored in the field?

Could you please provide a few more details? Like how do you create these new pages (via the Panel, programmatically).

The pages are created manually within the panel.

What does actually get stored in these pages fields in your content files?

corresponding result in the content file:

Projects-link:

 - projekte

I will post the template code below :slight_smile:

And the template code, see my edited message above…

This is the part which results in the same page object as the newly created page:
$page->projects_link()->toPage()

Editing the status of older pages does not result into the same problem. Creating new pages while using the same template as the older pages results in the same error. Pretty strange issue…

I wonder if it is somehow related to this other strange bug: Routing problems since 3.5.2 · Issue #3157 · getkirby/kirby · GitHub

As regards your second problem: Which thumb driver do you use? Is gd enabled on your PHP 8 version?

I wonder if it is somehow related to this other strange bug: Routing problems since 3.5.2 · Issue #3157 · getkirby/kirby · GitHub

So far I can’t relate my issue to that one posted. I never used the same id for the created pages.

I just realized that the issue does not happen when the new page is created as a subpage of another page (p.ex. project under projects page). It only happens with first level pages.

As regards your second problem: Which thumb driver do you use? Is gd enabled on your PHP 8 version?

Oh sorry, my fault! I just realized gd extension was not enabled by default in laragon…

Is your issue reproducible in a Kirby starterkit?

Is your issue reproducible in a Kirby starterkit?

No it’s not. I’ll have a look into my site.yml tomorrow. I think that’s where the fault lays in. Eventhough I have no clue why it worked with the versions before and suddenly it doesn’t. :joy:
Thank you very much for the right hint! :pray:

Okay, I found the cause of the issue.
On first level pages I use a “slug” field for being able to create a localized url for the page (DE: domain.com/de/projekte EN: domain.com/en/projects).
In the older versions of kirby it worked without the slug field being filled out and worked with the default one when the page was created. As soon as I fill out the slug field everything works fine.

Is there a way to copy the default one to the slug field when the page is created?
I tried it via the “default” value and {{page.id}} in the template. But while it works on headlines it does not seem to work on default values. :disappointed:
UPDATE: Nevermind, it’s done. I used a hook for that. :blush:

Ah, ok, so that mean that Kirby doesn’t find the page with the default slug in the non-default language? Or no page at all? That wouldn’t sound right to me. It would be helpful if you could post some more detailed steps to reproduce the issue.