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.