Yo Dawg, I heard you like $view->execute() I've created a View of all the views that Drupal knows about, whether they reside in code or in the DB. It works great, tells the user about each view, its tags, its displays, its base table, its fields if they exist, and its path.

I'm doing this by overriding execute(&amp;$view) in a custom query handler. A very truncated version of what I'm doing:

foreach(views_get_all_views() as $zview) {
    // Examine each display of each view.
    foreach($zview-&gt;display as $display) {
      $row = new stdClass();
      ... // Set the things on $row.
      $view-&gt;result[] = $row;
    }
}


Now I also want it to tell the user about each View's query.

If I do this it works (for the last of the many Views):

      $zxview = views_get_view($zview-&gt;name);
      $zxview-&gt;set_display($display-&gt;id);
      $zxview-&gt;pre_execute();
      $zxview-&gt;execute();
      dpm($zxview-&gt;query-&gt;query()-&gt;__toString());


but I have to do it outside of the foreach() that goes through each view. If I try to do $zxview-&gt;execute() inside foreach(views_get_all_views() as $zview) { ... } I get

PHP Fatal error:  Maximum function nesting level of '100' reached, aborting!


This makes sense, sort of. But, so how can I list the query being executed for each view next to the name of each view, within a view? (I'm already excluding views defined by the module defining this view of views.)
I searched on that error and you can increase the limit from 100 to something larger.
Increase the value of xdebug.max_nesting_level in your php.ini:

xdebug.max_nesting_level
Type: integer, Default value: 100
Controls
the protection mechanism for infinite recursion protection. The value
of this setting is the maximum level of nested functions that are
allowed before the script will be aborted.

Try setting it to 200

xdebug.max_nesting_level = 200

Thanks to Stack Exchange for the answer!