PHP8.2 compatibility

This commit is contained in:
Progi1984
2022-07-25 13:55:53 +02:00
parent f81720941c
commit d02ef6652a
10 changed files with 30 additions and 7 deletions

View File

@@ -31,6 +31,7 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
compiler:
- default
@@ -42,6 +43,9 @@ jobs:
- os: ubuntu-latest
php-version: "8.1"
compiler: jit
- os: ubuntu-latest
php-version: "8.2"
compiler: jit
steps:
- name: Checkout

View File

@@ -7,7 +7,7 @@ Smarty is a template engine for PHP, facilitating the separation of presentation
Read the [documentation](https://smarty-php.github.io/smarty/) to find out how to use it.
## Requirements
Smarty can be run with PHP 7.1 to PHP 8.1.
Smarty can be run with PHP 7.1 to PHP 8.2.
## Installation
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).

View File

@@ -38,3 +38,8 @@ services:
service: base
build:
dockerfile: ./utilities/testrunners/php81/Dockerfile
php82:
extends:
service: base
build:
dockerfile: ./utilities/testrunners/php82/Dockerfile

View File

@@ -2,7 +2,7 @@ What is Smarty?
==============
## Requirements
Smarty can be run with PHP 7.1 to PHP 8.1.
Smarty can be run with PHP 7.1 to PHP 8.2.
## Installation
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).

View File

@@ -54,13 +54,13 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile
if (Smarty::$_MBSTRING) {
if ($_double_encode) {
// php >=5.2.3 - go native
return 'mb_convert_encoding(htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' .
var_export($char_set, true) . ', ' . var_export($double_encode, true) .
'), "HTML-ENTITIES", ' . var_export($char_set, true) . ')';
return 'htmlspecialchars_decode(mb_convert_encoding(htmlentities(htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' .
var_export($char_set, true) . ', ' . var_export($double_encode, true) .
'), ENT_COMPAT, ' . var_export($char_set, true) . '),' . var_export($char_set, true) . '))';
} elseif ($double_encode) {
// php <5.2.3 - only handle double encoding
return 'mb_convert_encoding(htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' .
var_export($char_set, true) . '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')';
return 'htmlspecialchars_decode(mb_convert_encoding(htmlentities(htmlspecialchars((string)' . $params[ 0 ] . ', ENT_QUOTES, ' .
var_export($char_set, true) . '), ENT_COMPAT, ' . var_export($char_set, true) . '), ' . var_export($char_set, true) . '))';
} else {
// fall back to modifier.escape.php
}

View File

@@ -36,6 +36,7 @@
* @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
* @property mixed|\Smarty_Template_Cached configLoad
*/
#[\AllowDynamicProperties]
class Smarty_Internal_Extension_Handler
{
public $objType = null;

View File

@@ -24,6 +24,7 @@
*
* @method bool mustCompile()
*/
#[\AllowDynamicProperties]
class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
{
/**

View File

@@ -19,6 +19,7 @@
/**
* This class does contain the security settings
*/
#[\AllowDynamicProperties]
class Smarty_Security
{

View File

@@ -7,6 +7,7 @@
* @package Smarty
* @subpackage Template
*/
#[\AllowDynamicProperties]
class Smarty_Variable
{
/**

View File

@@ -0,0 +1,10 @@
FROM php:8.2-cli
## Basic utilities
RUN apt-get update -yqq && apt-get install -y curl apt-utils git zip unzip
## Composer
COPY ./utilities/testrunners/shared/install-composer.sh /root/install-composer.sh
WORKDIR /root
RUN sh ./install-composer.sh
RUN mv ./composer.phar /usr/local/bin/composer