mirror of
https://github.com/Mibew/handlebars.php.git
synced 2025-05-03 02:26:41 +03:00
fix 0 being treated as empty string, fixes #76
This commit is contained in:
parent
84c6e3006c
commit
35ea671fd7
@ -294,7 +294,7 @@ class Tokenizer
|
|||||||
*/
|
*/
|
||||||
protected function flushBuffer()
|
protected function flushBuffer()
|
||||||
{
|
{
|
||||||
if (!empty($this->buffer)) {
|
if (!empty($this->buffer) or $this->buffer === '0') {
|
||||||
$this->tokens[] = array(
|
$this->tokens[] = array(
|
||||||
self::TYPE => self::T_TEXT,
|
self::TYPE => self::T_TEXT,
|
||||||
self::VALUE => $this->buffer
|
self::VALUE => $this->buffer
|
||||||
|
@ -198,6 +198,12 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('data' => true),
|
array('data' => true),
|
||||||
'Yes'
|
'Yes'
|
||||||
),
|
),
|
||||||
|
# see the issue #76
|
||||||
|
array(
|
||||||
|
'{{#if data}}0{{/if}}',
|
||||||
|
array('data' => true),
|
||||||
|
'0'
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'{{#if data}}Yes{{/if}}',
|
'{{#if data}}Yes{{/if}}',
|
||||||
array('data' => false),
|
array('data' => false),
|
||||||
|
Loading…
Reference in New Issue
Block a user