Skip to content

Commit 2d6ea9d

Browse files
committed
feat: enhance debug instrumentation by invalidating OPcache for instrumented files
1 parent dce4850 commit 2d6ea9d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/debug.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,16 @@ function ddless_instrument_all_project_files(): int
28182818
$instrumented = ddless_instrument_php_file($absolutePath);
28192819
if ($instrumented !== null) {
28202820
$GLOBALS['__DDLESS_INSTRUMENTED_CODE__'][$absolutePath] = $instrumented;
2821+
if (function_exists('opcache_invalidate')) {
2822+
opcache_invalidate($absolutePath, true);
2823+
}
2824+
$realAbsPath = realpath($absolutePath);
2825+
if ($realAbsPath && $realAbsPath !== $absolutePath) {
2826+
$GLOBALS['__DDLESS_INSTRUMENTED_CODE__'][$realAbsPath] = $instrumented;
2827+
if (function_exists('opcache_invalidate')) {
2828+
opcache_invalidate($realAbsPath, true);
2829+
}
2830+
}
28212831
ddless_log("[ddless] Instrumented (with breakpoints): {$info['relativePath']}\n");
28222832
}
28232833
}

0 commit comments

Comments
 (0)