Skip to content

Link Fieldtype recursion #15002

Description

@mytchallb

Bug description

When trying to fetch an entry which contains a link fieldtype set to itself there is infinite recursion.
Suggest adding a limit or show a warning.

How to reproduce

Statamic 6, fresh install.
Created a link fieldset for homepage blueprint.
Set entry to homepage.

Created api route to return homepage:

Route::get('/test', function () {
    $entry = Entry::query()->where('slug', 'home')->first();
    return response()->json($entry);
});

Logs

Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?

Environment

Environment
Laravel Version: 12.63.0
PHP Version: 8.4.22
Composer Version: 2.10.2
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 0
License Key: Not set
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.24.2 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

Using DDEV

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions