Skip to content

Conversation

@DavideIadeluca
Copy link
Contributor

@DavideIadeluca DavideIadeluca commented Oct 22, 2025

1.x equivalent to #4263

Fixes #0000
In some environments, it's possible that a combination of multiple extensions / configs causes the max_nesting_level of to exceed 200, causing the following error:

flarum.ERROR: Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '200'

This is particularly an issue for local development where both Xdebug and Flarums debug mode is enabled, meaning the LessCompiler is hit on every request to the forum.

Changes proposed in this pull request:
This PR stores the current nesting level and resets it after less compliation is done.

Reviewers should focus on:
If xdebug.max_nesting_level is not set, ini_get() will return false. To address this I've wrapped the restoration to avoid setting this value to false.

Screenshot

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)

@DavideIadeluca DavideIadeluca changed the title fix(core): restore xdebug.max_nesting_level after less compilation [1.x] fix(core): restore xdebug.max_nesting_level after less compilation Oct 22, 2025
@DavideIadeluca DavideIadeluca marked this pull request as ready for review October 22, 2025 13:45
@DavideIadeluca DavideIadeluca requested a review from a team as a code owner October 22, 2025 13:45
@imorland imorland added this to the 1.8.12 milestone Oct 27, 2025
@imorland imorland merged commit ee23458 into flarum:1.x Oct 27, 2025
321 checks passed
@imorland imorland deleted the di/xdebug-max-nesting branch October 27, 2025 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants