bobthecow/mustache.php — Issue #59: Pragma in constructor not working
Author: wmorancfi
Created: 2011-10-11 14:15:28+00:00
State: open

Passing the unescaped pragma as part of the options array in the constructor doesn't work.

It seems as if the problem is that _pragmas and _localPragmas are stored differently (_pragmas uses the array value as the pragma, whereas _localPragmas uses the array key, and I assume (from the code) that the value can be true or false to indicate whether the pragma is enabled or disabled)

Unfortunately, line 381 (method _renderPragmas()) simply copies _pragmas to _localPragmas, which results in data that's interpreted wrong later.

I fixed this by changing line 381 from
$this->_localPragmas = $this->_pragmas;
to
$this->_localPragmas = array_fill_keys($this->_pragmas, true);