mirror of
				https://github.com/Mibew/handlebars.php.git
				synced 2025-11-04 04:05:07 +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()
 | 
			
		||||
    {
 | 
			
		||||
        if (!empty($this->buffer)) {
 | 
			
		||||
        if (!empty($this->buffer) or $this->buffer === '0') {
 | 
			
		||||
            $this->tokens[] = array(
 | 
			
		||||
                self::TYPE => self::T_TEXT,
 | 
			
		||||
                self::VALUE => $this->buffer
 | 
			
		||||
 | 
			
		||||
@ -198,6 +198,12 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
 | 
			
		||||
                array('data' => true),
 | 
			
		||||
                'Yes'
 | 
			
		||||
            ),
 | 
			
		||||
            # see the issue #76
 | 
			
		||||
            array(
 | 
			
		||||
                '{{#if data}}0{{/if}}',
 | 
			
		||||
                array('data' => true),
 | 
			
		||||
                '0'
 | 
			
		||||
            ),
 | 
			
		||||
            array(
 | 
			
		||||
                '{{#if data}}Yes{{/if}}',
 | 
			
		||||
                array('data' => false),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user