You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MagicMapper circular-construction guard — investigate root cause and remove guard #1564
lib/Db/MagicMapper.php:337-348 contains a static counter + guard that bails out of `__construct()` without calling `initializeHandlers()` when the third instantiation happens within a request:
```php
self::$constructCount++;
if (self::$constructCount > 2) {
// Guard against the circular-construction case
$this->logger->warning(...);
return;
}
$this->initializeHandlers();
```
When the guard trips, the mapper exists but is unusable — every subsequent method call hits a null handler. That's better than infinite recursion, but it suggests there's a real circular DI graph somewhere that should be fixed at the source.
What this PR fixed
Removed two debug `file_put_contents('/tmp/or-debug.log', ...)` calls that were silently writing to disk and (more visibly) triggering "Permission denied" PHP warnings during test runs — see test output mention in PR #1563 (the upstream-quality-cleanup PR that filed this issue). The guard itself is left in place because removing it could trigger the underlying circular case.
What needs investigating
Reproduce the third-construction scenario locally — when does MagicMapper get instantiated 3+ times in a single request?
Trace the circular path: which dependency of MagicMapper transitively re-instantiates MagicMapper?
Break the cycle properly (lazy DI / interface / factory)
Remove the static counter + guard once the root cause is fixed
Acceptance criteria
Document the dependency cycle that necessitated the guard
Apply structural fix (likely `Closure` lazy resolution or a dedicated factory for the cyclic dep)
Delete `self::$constructCount` field, the guard, and the warning log
Test that the previously-cyclic instantiation path now works
Activity
fix(quality): clean development to 0 failing CI checks (#1565)
fix(magicmapper): remove dead circular-construction guard (#1569)