replace functions deprecated in PHP 7.2

This commit is contained in:
Uwe Tews
2017-11-03 07:39:13 +01:00
parent 23d29f2ea3
commit 4ab9757b49
3 changed files with 15 additions and 10 deletions

View File

@@ -1,3 +1,8 @@
===== 2.6.31 ===
2017-11-03
* replace functions deprecated in PHP 7.2
2016-09-11 Uwe Tews
* {math} fix parameter checking order to avoid misleading message
* {math} replace wrong versiom

View File

@@ -27,7 +27,7 @@
* @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net>
* @package Smarty
* @version 2.6.30
* @version 2.6.31-dev
*/
/* $Id$ */
@@ -465,7 +465,7 @@ class Smarty
*
* @var string
*/
var $_version = '2.6.30';
var $_version = '2.6.31';
/**
* current template inclusion depth

View File

@@ -259,14 +259,9 @@ class Smarty_Compiler extends Smarty {
preg_match_all($search, $source_content, $match, PREG_SET_ORDER);
$this->_folded_blocks = $match;
reset($this->_folded_blocks);
/* replace special blocks by "{php}" */
$source_content = preg_replace_callback($search, create_function ('$matches', "return '"
. $this->_quote_replace($this->left_delimiter) . 'php'
. "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
. $this->_quote_replace($this->right_delimiter)
. "';")
$source_content = preg_replace_callback($search, array($this,'_preg_callback')
, $source_content);
/* Gather all template tags. */
@@ -556,7 +551,7 @@ class Smarty_Compiler extends Smarty {
case 'php':
/* handle folded tags replaced by {php} */
list(, $block) = each($this->_folded_blocks);
$block = array_shift($this->_folded_blocks);
$this->_current_line_no += substr_count($block[0], "\n");
/* the number of matched elements in the regexp in _compile_file()
determins the type of folded tag that was found */
@@ -754,7 +749,12 @@ class Smarty_Compiler extends Smarty {
return true;
}
function _preg_callback ($matches) {
return $this->_quote_replace($this->left_delimiter)
. 'php'
. str_repeat("\n", substr_count($matches[1], "\n"))
. $this->_quote_replace($this->right_delimiter);
}
/**
* compile custom function tag
*