I noticed that when rendering a field the static recursion tracker variable is not unset for the current view and display when returning an empty result.

views_field_view_handler_field_view.inc line: 313

      if ($this->options['view'] && !$this->options['query_aggregation']) {
        $running[$this->options['view']][$this->options['display']] = TRUE;
        $args = array();

        // Only perform this loop if there are actually arguments present.
        if (!empty($this->options['arguments'])) {
          // Create array of tokens.
          foreach ($this->split_tokens($this->options['arguments']) as $token) {
            $args[] = $this->get_token_value($token, $values, $this->view);
          }
        }

        // get view etc‚ and execute.
        $view = views_get_view($this->options['view']);

        // Only execute and render the view if the user has access.
        if ($view->access($this->options['display'])) {
          $view->set_display($this->options['display']);
          $view->pre_execute($args);
          $view->execute();

          // If there are no results and hide_empty is set.
          if (empty($view->result) && $this->options['hide_empty']) {
            return $output;
          }
          // Else just call render on the view object.
          else {
            $output = $view->render();
          }
        }

        $running[$this->options['view']][$this->options['display']] = FALSE;
      }

Note that there is a return without setting $running[$this->options['view']][$this->options['display']] to false, prior to returning.

This is my first bug report so if there are farther details required let me know.

Comments

damiankloip’s picture

Status: Needs work » Active

Needs work is for patches needing work.

What behaviour are you actually expecting that you shouldn't?

damiankloip’s picture

Status: Active » Fixed

Ok, this does make sense anyway. I have just committed a fix to the 7.x branch for this: http://drupalcode.org/project/views_field_view.git/commit/9f67e2e

Feel free to test! :)

chrinor2002’s picture

We have a project listing various nodes using a view. We tried embedding a view and noticed that if the embedded view was empty after rendering, the rest of the rows in the parent view output a "Recursion Stop!". It took a while but after noticing that the output was around where the embedded view was, I dug a bit deeper and found it. Once I looked at what the loop was really doing, it made a lot more sense.

I will try to test once the project is out of the way and we have some down time.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.