Skip to content

Commit

Permalink
- bugfix {if $foo instanceof $bar} failed to compile if 2nd value is …
Browse files Browse the repository at this point in the history
…a variable #92 (reverted from commit 428e667)
  • Loading branch information
uwetews committed Oct 8, 2015
1 parent 428e667 commit 788566c
Showing 1 changed file with 8 additions and 32 deletions.
40 changes: 8 additions & 32 deletions lexer/smarty_internal_templateparser.y
Original file line number Diff line number Diff line change
Expand Up @@ -31,68 +31,58 @@ class Smarty_Internal_Templateparser
* @var bool
*/
public $successful = true;

/**
* return value
*
* @var mixed
*/
public $retvalue = 0;

/**
* counter for prefix code
*
* @var int
*/
public static $prefix_number = 0;

/**
* @var
*/
public $yymajor;

/**
* last index of array variable
*
* @var mixed
*/
public $last_index;

/**
* last variable name
*
* @var string
*/
public $last_variable;

/**
* root parse tree buffer
*
* @var Smarty_Internal_ParseTree
*/
public $root_buffer;

/**
* current parse tree object
*
* @var Smarty_Internal_ParseTree
*/
public $current_buffer;

/**
* lexer object
*
* @var Smarty_Internal_Templatelexer
*/
public $lex;

/**
* internal error flag
*
* @var bool
*/
private $internalError = false;

/**
* {strip} status
*
Expand All @@ -105,21 +95,18 @@ class Smarty_Internal_Templateparser
* @var Smarty_Internal_TemplateCompilerBase
*/
public $compiler = null;

/**
* smarty object
*
* @var Smarty
*/
public $smarty = null;

/**
* template object
*
* @var Smarty_Internal_Template
*/
public $template = null;

/**
* block nesting level
*
Expand All @@ -134,20 +121,6 @@ class Smarty_Internal_Templateparser
*/
public $security = null;

/**
* template prefix array
*
* @var \Smarty_Internal_ParseTree[]
*/
public $template_prefix = array();

/**
* security object
*
* @var \Smarty_Internal_ParseTree[]
*/
public $template_postfix = array();

/**
* constructor
*
Expand Down Expand Up @@ -223,8 +196,7 @@ class Smarty_Internal_Templateparser
// complete template
//
start(res) ::= template. {
$this->root_buffer->prepend_array($this, $this->template_prefix);
$this->root_buffer->append_array($this, $this->template_postfix);
$this->compiler->processInheritance($this);
res = $this->root_buffer->to_smarty_php($this);
}

Expand Down Expand Up @@ -822,15 +794,15 @@ value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
self::$prefix_number++;
if (vi['var'] == '\'smarty\'') {
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.' = '. $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).';?>';
} else {
} else {
$this->compiler->prefix_code[] = '<?php $_tmp'.self::$prefix_number.' = '. $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>';
}
res = '$_tmp'.self::$prefix_number.'::'.r[0].r[1];
}

// Smarty tag
value(res) ::= smartytag(st). {
self::$prefix_number++;
self::$prefix_number++;
$tmp = $this->compiler->appendCode('<?php ob_start();?>', st);
$this->compiler->prefix_code[] = $this->compiler->appendCode($tmp, '<?php $_tmp'.self::$prefix_number.'=ob_get_clean();?>');
res = '$_tmp'.self::$prefix_number;
Expand Down Expand Up @@ -867,7 +839,11 @@ ns1(res) ::= ID(i). {

ns1(res) ::= NAMESPACE(i). {
res = i;
}
}

//ns1(res) ::= variable(v). {
// res = v;
//}



Expand Down

0 comments on commit 788566c

Please sign in to comment.