Add debug_tracer.php

This commit is contained in:
Ivor Barhansky 2025-05-21 11:41:43 +00:00
parent e652df627f
commit 4487730549

15
debug_tracer.php Normal file
View File

@ -0,0 +1,15 @@
<?php
// Вставить в начало любого метода чтобы отследить откуда он вызывается.
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5);
foreach ($trace as $i => $frame) {
$file = $frame['file'] ?? '[internal]';
$line = $frame['line'] ?? '?';
$func = $frame['function'] ?? '?';
$class = $frame['class'] ?? '';
$type = $frame['type'] ?? '';
echo "#$i $file:$line $class$type$func()\n";
}