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

[5.x]: "actionRecentActivity" throws "Nesting level too deep - recursive dependency?" #15915

Closed
gopeter opened this issue Oct 17, 2024 · 4 comments
Labels

Comments

@gopeter
Copy link
Contributor

gopeter commented Oct 17, 2024

What happened?

Description

Looking at my PHP error logs, I sometimes find this:

2024-10-17 10:26:47 [web.ERROR] [yii\base\ErrorException:1] Nesting level too deep - recursive dependency? {"trace":["#0 [internal function]: yii\\base\\ErrorHandler->handleFatalError()","#1 {main}"],"memory":3935280,"exception":"[object] (yii\\base\\ErrorException(code: 1): Nesting level too deep - recursive dependency? at /var/www/releases/21/vendor/craftcms/cms/src/services/Elements.php:2717)"} 

Looking further in the application log, I have some more details:

2024-10-17 10:26:47 [web.WARNING] [application] Request context: {"environment":"production","userId":...,"sessionId":"...","body":"{\"elementType\":\"craft\\\\commerce\\\\elements\\\\Product\",\"elementId\":155830,\"draftId\":null,\"siteId\":12,\"provisional\":false}","vars":{"_GET":{"p":"admin/actions/elements/recent-activity","site":"esEn","dontExtendSession":"1","v":"1729153607180"},"_FILES":[]

Steps to reproduce

  1. That's the point – I can't reproduce it. It happens, but I cant reproduce it. We have 3 matrix fields, but they have only one level, nothing deeply stacked.

Expected behavior

That we don't get this error.

Actual behavior

That the PHP error appears.

Craft CMS version

Craft Pro 5.4.8

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

  • Commerce 5.1.3
@gopeter gopeter added the bug label Oct 17, 2024
@brandonkelly
Copy link
Member

Were you running Craft 5.4.8 when this error occurred (2024-10-17 10:26:47)? Because I don’t see how you’d ever get that PHP error from services/Elements.php line 2717:

array_splice($activity, array_search($newerRecord, $activity), 1);

Normally when we see that error, it’s due to an infinite recursion bug. But there’s no recursive code leading up to this point.

@gopeter
Copy link
Contributor Author

gopeter commented Oct 22, 2024

Hi @brandonkelly. I've checked this again and found a new log entry:

[21-Oct-2024 10:50:13 Europe/Berlin] PHP Fatal error: Nesting level too deep - recursive dependency? in /var/www/releases/30/vendor/craftcms/cms/src/services/Elements.php on line 2717

I am on Craft Pro 5.4.8. I also took a the look at the current file and it's indeed "array_splice($activity, array_search($newerRecord, $activity), 1);".

Here's some more info from the web log:

2024-10-21 10:50:13 [web.ERROR] [yii\base\ErrorException:1] Nesting level too deep - recursive dependency? {"trace":["#0 [internal function]: yii\\base\\ErrorHandler->handleFatalError()","#1 {main}"],"memory":3995688,"exception":"[object] (yii\\base\\ErrorException(code: 1): Nesting level too deep - recursive dependency? at /var/www/releases/30/vendor/craftcms/cms/src/services/Elements.php:2717)"} 
2024-10-21 10:50:13 [web.WARNING] [application] Request context: {"environment":"production","userId":1,"sessionId":"...","body":"{\"elementType\":\"craft\\\\commerce\\\\elements\\\\Product\",\"elementId\":187456,\"draftId\":null,\"siteId\":9,\"provisional\":false}","vars":{"_GET":{"p":"admin/actions/elements/recent-activity","site":"chEn","dontExtendSession":"1","v":"1729500613776"},"_FILES":[],"_COOKIE": ...}

@brandonkelly
Copy link
Member

Not able to reproduce, but it looks like this was due to a PHP bug in array_search(). I just refactored the code a bit to avoid array_search() and tagged 4.12.8 and 5.4.9 with the change. Let me know if it helps!

@gopeter
Copy link
Contributor Author

gopeter commented Oct 22, 2024

Thanks a lot! Will keep an eye on it and let you know in a few days!

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