Răsfoiți Sursa

Fixed root context swap in clone (was checking context[0], should have checked last element in context stack).

Justin Hileman 15 ani în urmă
părinte
comite
eb1a896569
1 a modificat fișierele cu 4 adăugiri și 2 ștergeri
  1. 4 2
      Mustache.php

+ 4 - 2
Mustache.php

@@ -92,9 +92,11 @@ class Mustache {
 		$this->_otag = '{{';
 		$this->_ctag = '}}';
 		$this->_localPragmas = null;
+
 		if ($keys = array_keys($this->_context)) {
-			if ($this->_context[$keys[0]] instanceof Mustache) {
-				$this->_context[$keys[0]] =& $this;
+			$last = array_pop($keys);
+			if ($this->_context[$last] instanceof Mustache) {
+				$this->_context[$last] =& $this;
 			}
 		}
 	}