Brute force method, because sometimes flexible variables are not directly assigned, but their names can be stored in variables that are combined from many lines or are the result of certain functions, which makes it impossible to search files simply by searching / greping.
First, write your own function to print a readable reverse line, i.e.
function print_backtrace() { $backtrace = debug_backtrace(FALSE); foreach($backtrace as $trace) echo "{$trace['file']} :: {$trace['line']}<br>"; }
Open the smarty main file ( Smarty.class.php by default), and around line 580 there is a function named assign . Modify it to view the name of the required variable:
function assign($tpl_var, $value = null) { if($tpl_var == 'FOOBAR') { print_backtrace(); exit; }
The same modification may be required for the second function - assign_by_ref . Now after running the script you should have this output:
D:\www\test_proj\libs\smarty\Smarty.class.php :: 584 D:\www\test_proj\classes.php :: 11 D:\www\test_proj\classes.php :: 6 D:\www\test_proj\functions.php :: 7 D:\www\test_proj\index.php :: 100
The second line indicates where the variable was assigned.
dev-null-dweller
source share