Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find a hidden PHP function?

Tags:

function

php

So I picked up a job that requires me to fix some broken code that another programmer wrote. It's a mess and is hard to read, but what really gets me is that I need to find a specific function that is buried somewhere in hundreds of php files.

If you were given the function name, say <?php print mystery_function(); ?>, how would one go about tracking this down?

Aside from the brute method of ftping the entire site and having windows search through each file (which I am about to do), is there a way of sending a value to that function and producing an error that is traceable?

like image 829
Eric Avatar asked Nov 30 '22 07:11

Eric


1 Answers

$reflection = new ReflectionFunction('mystery_function');
echo $reflection->getFileName();

http://www.php.net/manual/en/class.reflectionfunction.php

like image 175
deceze Avatar answered Dec 06 '22 03:12

deceze