Ticket #1422: 1422_2.patch

File 1422_2.patch, 1.7 KB (added by Frederico Caldeira Knabben, 15 years ago)
  • _source/includes/fckfunctionprocessor.inc

     
    5656                if ( !$this->_IsGlobal )
    5757                        $processed = $this->_ProcessVars( $processed, $this->_Parameters ) ;
    5858
    59                 $numVarMatches = preg_match_all( '/\bvar\b\s+([\w_][\w\d_]+)/', $processed, $varsMatches ) ;
    60 
     59                $numVarMatches = preg_match_all( '/\bvar\b\s+(.+?)(?=;)/', $processed, $varsMatches ) ;
     60               
    6161                if ( $numVarMatches > 0 )
    6262                {
    6363                        $vars = array() ;
    6464
    6565                        for ( $i = 0 ; $i < $numVarMatches ; $i++ )
    6666                        {
    67                                 $vars[] = $varsMatches[1][$i] ;
     67                                $numVarNameMatches = preg_match_all( '/(?:^|,)\s*([^\s=,]+)/', $varsMatches[1][$i], $varNameMatches ) ;
     68                               
     69                                for ( $j = 0 ; $j < $numVarNameMatches ; $j++ )
     70                                {
     71                                        $vars[] = $varNameMatches[1][$j] ;
     72                                }
    6873                        }
    6974
    7075                        $processed = $this->_ProcessVars( $processed, $vars ) ;
     
    7883                foreach ( $vars as $var )
    7984                {
    8085                        if ( strlen( $var) > 1 )
    81                                 $source = preg_replace( '/(?<!\w|\d|\.)' . $var . '(?!\w|\d)/', $this->_GetVarName(), $source ) ;
     86                                $source = preg_replace( '/(?<!\w|\d|\.)' . preg_quote( $var ) . '(?!\w|\d)/', $this->_GetVarName(), $source ) ;
    8287                }
    8388
    8489                return $source ;
     
    9499
    95100                $var = $this->_VarPrefix . $this->_VarChars[ $this->_LastCharIndex++ ] ;
    96101
    97                 if ( preg_match( '/(?<!\w|\d|\.)' . $var . '(?!\w|\d)/', $this->_Function ) )
     102                if ( preg_match( '/(?<!\w|\d|\.)' . preg_quote( $var ) . '(?!\w|\d)/', $this->_Function ) )
    98103                        return $this->_GetVarName() ;
    99104                else
    100105                        return $var ;
     
    116121        }
    117122}
    118123
    119 ?>
    120  No newline at end of file
     124?>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy