Changeset 435

Show
Ignore:
Timestamp:
05/09/07 13:55:00 (2 years ago)
Author:
laurentj
Message:

fix regression bug in jtpl : use of true, false and null were not allowed anymore in expression

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/tpl/jTplCompiler.class.php

    r430 r435  
    4949    protected $_allowedAssign; 
    5050    protected $_allowedInForeach; 
     51 
     52    protected $_allowedConstants = array('TRUE','FALSE','NULL', 'M_1_PI', 'M_2_PI', 'M_2_SQRTPI', 'M_E',  
     53        'M_LN10', 'M_LN2', 'M_LOG10E', 'M_LOG2E', 'M_PI','M_PI_2','M_PI_4','M_SQRT1_2','M_SQRT2'); 
    5154 
    5255    private $_pluginPath=array(); 
     
    417420                    $result.='$t->_vars[\''.substr($str,1).'\']'; 
    418421                }elseif($type == T_WHITESPACE || in_array($type, $allowed)){ 
    419                     if($type == T_STRING && defined($str)){ 
     422                    if($type == T_STRING && defined($str) && !in_array(strtoupper($str),$this->_allowedConstants)){ 
    420423                        $this->doError2('errors.tpl.tag.constant.notallowed', $this->_currentTag, $str); 
    421424                    } 
  • trunk/testapp/modules/unittest/classes/utjtplexpr.class.php

    r415 r435  
    9999        '$aa*(234+$b)'=>'$t->_vars[\'aa\']*(234+$t->_vars[\'b\'])', 
    100100        '$aa[$bb[4]]'=>'$t->_vars[\'aa\'][$t->_vars[\'bb\'][4]]', 
     101        '$aa == false'=>'$t->_vars[\'aa\'] == false', 
     102        '$aa == true'=>'$t->_vars[\'aa\'] == true', 
     103        '$aa == null'=>'$t->_vars[\'aa\'] == null', 
    101104 
    102105    ); 
Download in other formats: Unified Diff Zip Archive