Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive Link loop #348

Closed
ScottPenhall98 opened this issue Sep 5, 2024 · 6 comments
Closed

Recursive Link loop #348

ScottPenhall98 opened this issue Sep 5, 2024 · 6 comments
Labels

Comments

@ScottPenhall98
Copy link

Bug description

If you are to create a Link field on Entry A that links to Entry B, then on Entry B make a link to Entry A, you get either a never ending save, or a timeout error.

Just to double check this bug I tried replicating this on Statamic core, and it does not seem to be an issue there. We believe it to be an issue only with The Eloquent driver package.

How to reproduce

Create a Link field on Entry A that links to Entry B, then on Entry B make a link to Entry A

Logs

No response

Environment

Environment
Application Name: _
Laravel Version: 10.48.9
PHP Version: 8.3.6
Composer Version: 2.2.22
Environment: local
Debug Mode: ENABLED
URL: _
Maintenance Mode: OFF

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

Drivers
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: database
Session: file

Statamic
Addons: 2
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.12.0 Solo

Statamic Addons
jacksleight/statamic-bard-texstyle: 3.2.2
statamic/eloquent-driver: 4.8.1

Statamic Eloquent Driver
Asset Containers: eloquent
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: file
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Taxonomies: eloquent
Terms: eloquent
Tokens: file

Additional details

We are using Lando as a way to run our project, which is a wrapper of docker compose:
name: _
recipe: laravel
services:
database:
portforward: 3306
appserver:
build_as_root:
- a2enmod expires headers
mailhog:
type: mailhog
hogfrom:
- appserver
proxy:
mailhog:
- mail.lndo.site
config:
php: '8.3'
webroot: public
database: mysql:8.0
xdebug: true

@ScottPenhall98 ScottPenhall98 added the bug Something isn't working label Sep 5, 2024
@duncanmcclean
Copy link
Member

I can't seem to reproduce this issue on the latest versions of Statamic and the Eloquent Driver. 🤔

Are you able to try updating Statamic and the Eloquent Driver in your project. They both seem to be running slightly older versions.

If that doesn't help, are you able to share the YAML for the blueprint(s) in question?

@ScottPenhall98
Copy link
Author

I can't seem to reproduce this issue on the latest versions of Statamic and the Eloquent Driver. 🤔

Are you able to try updating Statamic and the Eloquent Driver in your project. They both seem to be running slightly older versions.

If that doesn't help, are you able to share the YAML for the blueprint(s) in question?

Hey @duncanmcclean, I'm not sure if it is blueprint related as we managed to replicate it on another one of our projects as well as fresh Statamic Pages. I will try update the Statamic and Eloquent Version and get back to you on how that turns out

@ScottPenhall98
Copy link
Author

ScottPenhall98 commented Sep 10, 2024

error_screen

Application Name: _
Laravel Version: 10.48.9
PHP Version: 8.3.6
Composer Version: 2.2.22
Environment: local
Debug Mode: ENABLED
URL: _
Maintenance Mode: OFF

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

Drivers
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: database
Session: file

Statamic
Addons: 2
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.20.0 Solo

Statamic Addons
jacksleight/statamic-bard-texstyle: 3.2.2
statamic/eloquent-driver: 4.14.1

Statamic Eloquent Driver
Asset Containers: eloquent
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: file
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Sites: file
Taxonomies: eloquent
Terms: eloquent
Tokens: file

Updated Both Statamic and the Eloquent Driver but atleast now I got an error message that you can see in the Image.

Page Blueprint:

tabs:
  main:
    display: Main
    sections:
      -
        display: Main
        fields:
          -
            handle: title
            field:
              type: text
              required: true
              validate:
                - required
          -
            import: main_section
      -
        display: Content
        fields:
          -
            import: content_blocks
  sidebar:
    display: Sidebar
    sections:
      -
        fields:
          -
            handle: slug
            field:
              type: slug
              localizable: true
              validate: 'max:200'
          -
            handle: parent
            field:
              type: entries
              collections:
                - pages
              max_items: 1
              listable: false
              localizable: true
          -
            handle: template
            field:
              type: template
              display: Template

Main section fieldset (where I added the Link From Page A to B and vice versa)

fields:
  -
    handle: navigation_label
    field:
      type: text
      display: 'Navigation Label'
  -
    handle: image_field
    field:
      container: images
      type: assets
      display: 'Image field'
      max_files: 1
  -
    handle: video_field_duplicate
    field:
      container: videos
      type: assets
      display: 'video field'
      max_files: 1
  -
    handle: background_media
    field:
      options:
        image: Image
        video: Video
      type: radio
      display: 'Background Media'
      instructions: 'Which header background do you want to display?'
      cast_booleans: true
      default: image
  -
    import: button
  -
    handle: options
    field:
      options:
        full_screen: 'Full screen background media'
      type: checkboxes
      display: Options

@ScottPenhall98
Copy link
Author

@duncanmcclean could you provide a git repo of a working sample. We will attempt to reproduce the bug in isolation there.

Here is the stack trace of the issue I sent a screenshot of in my last message. It continues to loop but we have truncated it

[2024-09-10 04:59:55] local.ERROR: Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? {"userId":1,"exception":"[object] (Error(code: 0): Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion? at /app/vendor/laravel/framework/src/Illuminate/Collections/Arr.php:20)
[stacktrace]
#0 /app/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(328): Illuminate\\Support\\Arr::accessible(Array)
#1 /app/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(666): Illuminate\\Support\\Arr::get(Array, 0, NULL)
#2 /app/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php(204): Illuminate\\Support\\Arr::pull(Array, 0)
#3 [internal function]: Illuminate\\Routing\\RouteUrlGenerator->Illuminate\\Routing\\{closure}(Array)
#4 /app/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php(198): preg_replace_callback('/\\\\{.*?\\\\}/', Object(Closure), 'cp/collections/...')
#5 /app/vendor/laravel/framework/src/Illuminate/Routing/RouteUrlGenerator.php(85): Illuminate\\Routing\\RouteUrlGenerator->replaceRouteParameters('cp/collections/...', Array)
#6 /app/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php(500): Illuminate\\Routing\\RouteUrlGenerator->to(Object(Illuminate\\Routing\\Route), Array, true)
#7 /app/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php(469): Illuminate\\Routing\\UrlGenerator->toRoute(Object(Illuminate\\Routing\\Route), Array, true)
#8 /app/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(811): Illuminate\\Routing\\UrlGenerator->route('statamic.cp.col...', Array, true)
#9 /app/vendor/statamic/cms/src/Statamic.php(196): route('statamic.cp.col...', Array)
#10 /app/vendor/statamic/cms/src/helpers.php(9): Statamic\\Statamic::cpRoute('collections.ent...', Array)
#11 /app/vendor/statamic/cms/src/Entries/Entry.php(333): cp_route('collections.ent...', Array)
#12 /app/vendor/statamic/cms/src/Entries/Entry.php(287): Statamic\\Entries\\Entry->cpUrl('collections.ent...')
#13 /app/vendor/statamic/cms/src/Data/AbstractAugmented.php(141): Statamic\\Entries\\Entry->editUrl()
#14 /app/vendor/statamic/cms/src/Fields/Value.php(56): Statamic\\Data\\AbstractAugmented->Statamic\\Data\\{closure}(Object(Statamic\\Fields\\Value))
#15 /app/vendor/statamic/cms/src/Data/AbstractAugmented.php(78): Statamic\\Fields\\Value->resolve()
#16 /app/vendor/statamic/cms/src/Data/AbstractAugmented.php(52): Statamic\\Data\\AbstractAugmented->get('edit_url')
#17 /app/vendor/statamic/cms/src/Fields/Value.php(56): Statamic\\Data\\AbstractAugmented->Statamic\\Data\\{closure}(Object(Statamic\\Fields\\Value))
#18 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(53): Statamic\\Fields\\Value->resolve()
#19 [internal function]: Statamic\\Data\\AugmentedCollection->Statamic\\Data\\{closure}(Object(Statamic\\Fields\\Value), 'edit_url')
#20 /app/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(600): array_map(Object(Closure), Array, Array)
#21 /app/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(777): Illuminate\\Support\\Arr::map(Array, Object(Closure))
#22 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(53): Illuminate\\Support\\Collection->map(Object(Closure))
#23 /app/vendor/statamic/cms/src/Data/HasAugmentedInstance.php(35): Statamic\\Data\\AugmentedCollection->all()
#24 /app/vendor/statamic/cms/src/Fieldtypes/Link/ArrayableLink.php(17): Statamic\\Entries\\Entry->toAugmentedArray()
#25 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(87): Statamic\\Fieldtypes\\Link\\ArrayableLink->toArray()
#26 [internal function]: Statamic\\Data\\AugmentedCollection->Statamic\\Data\\{closure}(Object(Statamic\\Fieldtypes\\Link\\ArrayableLink), 'link_field')
#27 /app/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(600): array_map(Object(Closure), Array, Array)
#28 /app/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(777): Illuminate\\Support\\Arr::map(Array, Object(Closure))
#29 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(64): Illuminate\\Support\\Collection->map(Object(Closure))
#30 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(90): Statamic\\Data\\AugmentedCollection->toArray()
#31 [internal function]: Statamic\\Data\\AugmentedCollection->Statamic\\Data\\{closure}(Array, 'link_field')
#32 /app/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(600): array_map(Object(Closure), Array, Array)
#33 /app/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(777): Illuminate\\Support\\Arr::map(Array, Object(Closure))
#34 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(64): Illuminate\\Support\\Collection->map(Object(Closure))
#35 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(90): Statamic\\Data\\AugmentedCollection->toArray()
#36 [internal function]: Statamic\\Data\\AugmentedCollection->Statamic\\Data\\{closure}(Array, 'link_field')
#37 /app/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(600): array_map(Object(Closure), Array, Array)
#38 /app/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(777): Illuminate\\Support\\Arr::map(Array, Object(Closure))
#39 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(64): Illuminate\\Support\\Collection->map(Object(Closure))
#40 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(90): Statamic\\Data\\AugmentedCollection->toArray()
#41 [internal function]: Statamic\\Data\\AugmentedCollection->Statamic\\Data\\{closure}(Array, 'link_field')
#42 /app/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(600): array_map(Object(Closure), Array, Array)
#43 /app/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(777): Illuminate\\Support\\Arr::map(Array, Object(Closure))
#44 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(64): Illuminate\\Support\\Collection->map(Object(Closure))
#45 /app/vendor/statamic/cms/src/Data/AugmentedCollection.php(90): Statamic\\Data\\AugmentedCollection->toArray()
#46 [internal function]: Statamic\\Data\\AugmentedCollection->Statamic\\Data\\{closure}(Array, 'link_field')```

@ScottPenhall98
Copy link
Author

@duncanmcclean Turns out this issue occurs only when Telescope is installed

@ScottPenhall98
Copy link
Author

@duncanmcclean I will close this issue now and I have added this to Statamic Core: statamic/cms#10782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants