stack trace produced by the bug
When enabling profiling by providing a StartProfiler.php script along with setting
$wgDebugFunctionEntry = true;
php hits its maximum nesting level. The error stacktrace is attached.
In short, wfProfileIn calls wfDebug. wfDebug calls wfRunHooks which(the impl not the hooks) goes back to calling wfProfileIn by the 16th stack frame.
The bug can be reproduced for bisecting by creating StartProfiler.php and executing
$ echo "\$wgDebugFunctionEntry = true;wfProfileIn('test');" | php maintenance/eval.php
This finds af125df5199b5c232bf335d735cecc6d8f8e9784 as the change which caused this bug. Tested on a new mediawiki/vagrant instance with no additional extensions enabled.