Add PHP 8.4 support to Smarty (#1084)

* Add nullable types

* Removing deprecated E_STRICT constant from test suite.

* Added PHP 8.4 RC1 as test image

* PHP version bump in the README.md.

* Added PHP 8.4 to CI

* Add running tests for PHP 8.4
This commit is contained in:
Jonathan Lelievre
2024-11-21 23:04:22 +01:00
committed by GitHub
parent ffc4415a4f
commit bf87aee3f0
38 changed files with 123 additions and 103 deletions

View File

@@ -33,6 +33,7 @@ jobs:
- "8.1" - "8.1"
- "8.2" - "8.2"
- "8.3" - "8.3"
- "8.4"
compiler: compiler:
- default - default
@@ -50,6 +51,9 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
php-version: "8.3" php-version: "8.3"
compiler: jit compiler: jit
- os: ubuntu-latest
php-version: "8.4"
compiler: jit
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3

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. Read the [documentation](https://smarty-php.github.io/smarty/) to find out how to use it.
## Requirements ## Requirements
Smarty can be run with PHP 7.1 to PHP 8.3. Smarty can be run with PHP 7.1 to PHP 8.4.
## Installation ## Installation
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/). Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).

View File

@@ -13,12 +13,12 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
/** /**
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* *
* @return void * @return void
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$uid = ''; $uid = '';
$sources = array(); $sources = array();

View File

@@ -46,4 +46,9 @@ services:
extends: extends:
service: base service: base
build: build:
dockerfile: ./utilities/testrunners/php83/Dockerfile dockerfile: ./utilities/testrunners/php83/Dockerfile
php84:
extends:
service: base
build:
dockerfile: ./utilities/testrunners/php84/Dockerfile

View File

@@ -1,7 +1,7 @@
# Getting started # Getting started
## Requirements ## Requirements
Smarty can be run with PHP 7.1 to PHP 8.3. Smarty can be run with PHP 7.1 to PHP 8.4.
## Installation ## Installation
Smarty can be installed with [Composer](https://getcomposer.org/). Smarty can be installed with [Composer](https://getcomposer.org/).

View File

@@ -1036,11 +1036,11 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* Get unique template id * Get unique template id
* *
* @param string $template_name * @param string $template_name
* @param null|mixed $cache_id * @param null|mixed $cache_id
* @param null|mixed $compile_id * @param null|mixed $compile_id
* @param null $caching * @param null $caching
* @param \Smarty_Internal_Template $template * @param \Smarty_Internal_Template|null $template
* *
* @return string * @return string
* @throws \SmartyException * @throws \SmartyException
@@ -1050,7 +1050,7 @@ class Smarty extends Smarty_Internal_TemplateBase
$cache_id = null, $cache_id = null,
$compile_id = null, $compile_id = null,
$caching = null, $caching = null,
Smarty_Internal_Template $template = null ?Smarty_Internal_Template $template = null
) { ) {
$template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" : $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
$template_name; $template_name;

View File

@@ -44,15 +44,15 @@ abstract class Smarty_CacheResource
/** /**
* Read the cached template and process header * Read the cached template and process header
* *
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template $_template template object
* @param Smarty_Template_Cached $cached cached object * @param Smarty_Template_Cached|null $cached cached object
* @param boolean $update flag if called because cache update * @param boolean $update flag if called because cache update
* *
* @return boolean true or false if the cached content does not exist * @return boolean true or false if the cached content does not exist
*/ */
abstract public function process( abstract public function process(
Smarty_Internal_Template $_template, Smarty_Internal_Template $_template,
Smarty_Template_Cached $cached = null, ?Smarty_Template_Cached $cached = null,
$update = false $update = false
); );

View File

@@ -124,15 +124,15 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
/** /**
* Read the cached template and process the header * Read the cached template and process the header
* *
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
* @param Smarty_Template_Cached $cached cached object * @param Smarty_Template_Cached|null $cached cached object
* @param boolean $update flag if called because cache update * @param boolean $update flag if called because cache update
* *
* @return boolean true or false if the cached content does not exist * @return boolean true or false if the cached content does not exist
*/ */
public function process( public function process(
Smarty_Internal_Template $_smarty_tpl, Smarty_Internal_Template $_smarty_tpl,
Smarty_Template_Cached $cached = null, ?Smarty_Template_Cached $cached = null,
$update = false $update = false
) { ) {
if (!$cached) { if (!$cached) {

View File

@@ -88,15 +88,15 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
/** /**
* Read the cached template and process the header * Read the cached template and process the header
* *
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
* @param Smarty_Template_Cached $cached cached object * @param Smarty_Template_Cached|null $cached cached object
* @param boolean $update flag if called because cache update * @param boolean $update flag if called because cache update
* *
* @return boolean true or false if the cached content does not exist * @return boolean true or false if the cached content does not exist
*/ */
public function process( public function process(
Smarty_Internal_Template $_smarty_tpl, Smarty_Internal_Template $_smarty_tpl,
Smarty_Template_Cached $cached = null, ?Smarty_Template_Cached $cached = null,
$update = false $update = false
) { ) {
if (!$cached) { if (!$cached) {

View File

@@ -88,15 +88,15 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
/** /**
* Read the cached template and process its header * Read the cached template and process its header
* *
* @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template
* @param Smarty_Template_Cached $cached cached object * @param Smarty_Template_Cached|null $cached cached object
* @param bool $update flag if called because cache update * @param bool $update flag if called because cache update
* *
* @return boolean true or false if the cached content does not exist * @return boolean true or false if the cached content does not exist
*/ */
public function process( public function process(
Smarty_Internal_Template $_smarty_tpl, Smarty_Internal_Template $_smarty_tpl,
Smarty_Template_Cached $cached = null, ?Smarty_Template_Cached $cached = null,
$update = false $update = false
) { ) {
$_smarty_tpl->cached->valid = false; $_smarty_tpl->cached->valid = false;

View File

@@ -190,7 +190,7 @@ abstract class Smarty_Internal_Data
* *
* @return mixed variable value or or array of variables * @return mixed variable value or or array of variables
*/ */
public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) public function getTemplateVars($varName = null, ?Smarty_Internal_Data $_ptr = null, $searchParents = true)
{ {
return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents); return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents);
} }
@@ -200,7 +200,7 @@ abstract class Smarty_Internal_Data
* *
* @param \Smarty_Internal_Data|null $data * @param \Smarty_Internal_Data|null $data
*/ */
public function _mergeVars(Smarty_Internal_Data $data = null) public function _mergeVars(?Smarty_Internal_Data $data = null)
{ {
if (isset($data)) { if (isset($data)) {
if (!empty($this->tpl_vars)) { if (!empty($this->tpl_vars)) {

View File

@@ -24,14 +24,14 @@ class Smarty_Internal_Method_CreateData
* @api Smarty::createData() * @api Smarty::createData()
* @link https://www.smarty.net/docs/en/api.create.data.tpl * @link https://www.smarty.net/docs/en/api.create.data.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty $parent next higher level of Smarty * @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty|null $parent next higher level of Smarty
* variables * variables
* @param string $name optional data block name * @param string $name optional data block name
* *
* @return \Smarty_Data data object * @return \Smarty_Data data object
*/ */
public function createData(Smarty_Internal_TemplateBase $obj, Smarty_Internal_Data $parent = null, $name = null) public function createData(Smarty_Internal_TemplateBase $obj, ?Smarty_Internal_Data $parent = null, $name = null)
{ {
/* @var Smarty $smarty */ /* @var Smarty $smarty */
$smarty = $obj->_getSmartyObj(); $smarty = $obj->_getSmartyObj();

View File

@@ -24,17 +24,17 @@ class Smarty_Internal_Method_GetTemplateVars
* @api Smarty::getTemplateVars() * @api Smarty::getTemplateVars()
* @link https://www.smarty.net/docs/en/api.get.template.vars.tpl * @link https://www.smarty.net/docs/en/api.get.template.vars.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* @param string $varName variable name or null * @param string $varName variable name or null
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty|null $_ptr optional pointer to data object
* @param bool $searchParents include parent templates? * @param bool $searchParents include parent templates?
* *
* @return mixed variable value or or array of variables * @return mixed variable value or or array of variables
*/ */
public function getTemplateVars( public function getTemplateVars(
Smarty_Internal_Data $data, Smarty_Internal_Data $data,
$varName = null, $varName = null,
Smarty_Internal_Data $_ptr = null, ?Smarty_Internal_Data $_ptr = null,
$searchParents = true $searchParents = true
) { ) {
if (isset($varName)) { if (isset($varName)) {
@@ -87,7 +87,7 @@ class Smarty_Internal_Method_GetTemplateVars
public function _getVariable( public function _getVariable(
Smarty_Internal_Data $data, Smarty_Internal_Data $data,
$varName, $varName,
Smarty_Internal_Data $_ptr = null, ?Smarty_Internal_Data $_ptr = null,
$searchParents = true, $searchParents = true,
$errorEnable = true $errorEnable = true
) { ) {

View File

@@ -22,11 +22,11 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* *
* @return void * @return void
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$source->uid = $source->filepath = sha1($source->name); $source->uid = $source->filepath = sha1($source->name);
$source->timestamp = $source->exists = true; $source->timestamp = $source->exists = true;

View File

@@ -28,11 +28,11 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* *
* @throws SmartyException * @throws SmartyException
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$uid = ''; $uid = '';
$sources = array(); $sources = array();

View File

@@ -21,11 +21,11 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* *
* @throws \SmartyException * @throws \SmartyException
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$source->filepath = $this->buildFilepath($source, $_template); $source->filepath = $this->buildFilepath($source, $_template);
if ($source->filepath !== false) { if ($source->filepath !== false) {
@@ -93,12 +93,12 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
* build template filepath by traversing the template_dir array * build template filepath by traversing the template_dir array
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* *
* @return string fully qualified filepath * @return string fully qualified filepath
* @throws SmartyException * @throws SmartyException
*/ */
protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) protected function buildFilepath(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$file = $source->name; $file = $source->name;
// absolute file ? // absolute file ?

View File

@@ -23,11 +23,11 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* *
* @return void * @return void
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
if (strpos($source->resource, '://') !== false) { if (strpos($source->resource, '://') !== false) {
$source->filepath = $source->resource; $source->filepath = $source->resource;

View File

@@ -22,11 +22,11 @@ class Smarty_Internal_Resource_String extends Smarty_Resource
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* *
* @return void * @return void
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$source->uid = $source->filepath = sha1($source->name . $source->smarty->_joined_template_dir); $source->uid = $source->filepath = sha1($source->name . $source->smarty->_joined_template_dir);
$source->timestamp = $source->exists = true; $source->timestamp = $source->exists = true;

View File

@@ -17,11 +17,11 @@ class Smarty_Internal_Runtime_CodeFrame
/** /**
* Create code frame for compiled and cached templates * Create code frame for compiled and cached templates
* *
* @param Smarty_Internal_Template $_template * @param Smarty_Internal_Template $_template
* @param string $content optional template content * @param string $content optional template content
* @param string $functions compiled template function and block code * @param string $functions compiled template function and block code
* @param bool $cache flag for cache file * @param bool $cache flag for cache file
* @param \Smarty_Internal_TemplateCompilerBase $compiler * @param \Smarty_Internal_TemplateCompilerBase|null $compiler
* *
* @return string * @return string
*/ */
@@ -30,7 +30,7 @@ class Smarty_Internal_Runtime_CodeFrame
$content = '', $content = '',
$functions = '', $functions = '',
$cache = false, $cache = false,
Smarty_Internal_TemplateCompilerBase $compiler = null ?Smarty_Internal_TemplateCompilerBase $compiler = null
) { ) {
// build property code // build property code
$properties[ 'version' ] = Smarty::SMARTY_VERSION; $properties[ 'version' ] = Smarty::SMARTY_VERSION;

View File

@@ -168,7 +168,7 @@ class Smarty_Internal_Runtime_Inheritance
public function process( public function process(
Smarty_Internal_Template $tpl, Smarty_Internal_Template $tpl,
Smarty_Internal_Block $block, Smarty_Internal_Block $block,
Smarty_Internal_Block $parent = null ?Smarty_Internal_Block $parent = null
) { ) {
if ($block->hide && !isset($block->child)) { if ($block->hide && !isset($block->child)) {
return; return;

View File

@@ -149,7 +149,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
public function __construct( public function __construct(
$template_resource, $template_resource,
Smarty $smarty, Smarty $smarty,
Smarty_Internal_Data $_parent = null, ?Smarty_Internal_Data $_parent = null,
$_cache_id = null, $_cache_id = null,
$_compile_id = null, $_compile_id = null,
$_caching = null, $_caching = null,

View File

@@ -386,7 +386,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
public function compileTemplate( public function compileTemplate(
Smarty_Internal_Template $template, Smarty_Internal_Template $template,
$nocache = null, $nocache = null,
Smarty_Internal_TemplateCompilerBase $parent_compiler = null ?Smarty_Internal_TemplateCompilerBase $parent_compiler = null
) { ) {
// get code frame of compiled template // get code frame of compiled template
$_compiled_code = $template->smarty->ext->_codeFrame->create( $_compiled_code = $template->smarty->ext->_codeFrame->create(
@@ -407,9 +407,9 @@ abstract class Smarty_Internal_TemplateCompilerBase
/** /**
* Compile template source and run optional post filter * Compile template source and run optional post filter
* *
* @param \Smarty_Internal_Template $template * @param \Smarty_Internal_Template $template
* @param null|bool $nocache flag if template must be compiled in nocache mode * @param null|bool $nocache flag if template must be compiled in nocache mode
* @param \Smarty_Internal_TemplateCompilerBase $parent_compiler * @param \Smarty_Internal_TemplateCompilerBase|null $parent_compiler
* *
* @return string * @return string
* @throws \Exception * @throws \Exception
@@ -417,7 +417,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
public function compileTemplateSource( public function compileTemplateSource(
Smarty_Internal_Template $template, Smarty_Internal_Template $template,
$nocache = null, $nocache = null,
Smarty_Internal_TemplateCompilerBase $parent_compiler = null ?Smarty_Internal_TemplateCompilerBase $parent_compiler = null
) { ) {
try { try {
// save template object in compiler class // save template object in compiler class

View File

@@ -165,16 +165,16 @@ abstract class Smarty_Resource
* wrapper for backward compatibility to versions < 3.1.22 * wrapper for backward compatibility to versions < 3.1.22
* Either [$_template] or [$smarty, $template_resource] must be specified * Either [$_template] or [$smarty, $template_resource] must be specified
* *
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* @param Smarty $smarty smarty object * @param Smarty|null $smarty smarty object
* @param string $template_resource resource identifier * @param string $template_resource resource identifier
* *
* @return \Smarty_Template_Source Source Object * @return \Smarty_Template_Source Source Object
* @throws \SmartyException * @throws \SmartyException
*/ */
public static function source( public static function source(
Smarty_Internal_Template $_template = null, ?Smarty_Internal_Template $_template = null,
Smarty $smarty = null, ?Smarty $smarty = null,
$template_resource = null $template_resource = null
) { ) {
return Smarty_Template_Source::load($_template, $smarty, $template_resource); return Smarty_Template_Source::load($_template, $smarty, $template_resource);
@@ -193,10 +193,10 @@ abstract class Smarty_Resource
/** /**
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
*/ */
abstract public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null); abstract public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null);
/** /**
* populate Source Object with timestamp and exists from Resource * populate Source Object with timestamp and exists from Resource

View File

@@ -42,10 +42,10 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource
/** /**
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$source->filepath = $source->type . ':' . $this->generateSafeName($source->name); $source->filepath = $source->type . ':' . $this->generateSafeName($source->name);
$source->uid = sha1($source->type . ':' . $source->name); $source->uid = sha1($source->type . ':' . $source->name);

View File

@@ -63,16 +63,16 @@ class Smarty_Template_Config extends Smarty_Template_Source
* initialize Source Object for given resource * initialize Source Object for given resource
* Either [$_template] or [$smarty, $template_resource] must be specified * Either [$_template] or [$smarty, $template_resource] must be specified
* *
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* @param Smarty $smarty smarty object * @param Smarty|null $smarty smarty object
* @param string $template_resource resource identifier * @param string $template_resource resource identifier
* *
* @return Smarty_Template_Config Source Object * @return Smarty_Template_Config Source Object
* @throws SmartyException * @throws SmartyException
*/ */
public static function load( public static function load(
Smarty_Internal_Template $_template = null, ?Smarty_Internal_Template $_template = null,
Smarty $smarty = null, ?Smarty $smarty = null,
$template_resource = null $template_resource = null
) { ) {
static $_incompatible_resources = array('extends' => true, 'php' => true); static $_incompatible_resources = array('extends' => true, 'php' => true);

View File

@@ -148,16 +148,16 @@ class Smarty_Template_Source
* initialize Source Object for given resource * initialize Source Object for given resource
* Either [$_template] or [$smarty, $template_resource] must be specified * Either [$_template] or [$smarty, $template_resource] must be specified
* *
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
* @param Smarty $smarty smarty object * @param Smarty|null $smarty smarty object
* @param string $template_resource resource identifier * @param string $template_resource resource identifier
* *
* @return Smarty_Template_Source Source Object * @return Smarty_Template_Source Source Object
* @throws SmartyException * @throws SmartyException
*/ */
public static function load( public static function load(
Smarty_Internal_Template $_template = null, ?Smarty_Internal_Template $_template = null,
Smarty $smarty = null, ?Smarty $smarty = null,
$template_resource = null $template_resource = null
) { ) {
if ($_template) { if ($_template) {

View File

@@ -21,7 +21,7 @@ class SmartyCompilerException extends SmartyException
int $code = 0, int $code = 0,
?string $filename = null, ?string $filename = null,
?int $line = null, ?int $line = null,
Throwable $previous = null ?Throwable $previous = null
) { ) {
parent::__construct($message, $code, $previous); parent::__construct($message, $code, $previous);

View File

@@ -14,4 +14,5 @@ $COMPOSE_CMD run --rm php74 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php80 ./run-tests.sh $@ && \ $COMPOSE_CMD run --rm php80 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php81 ./run-tests.sh $@ && \ $COMPOSE_CMD run --rm php81 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php82 ./run-tests.sh $@ && \ $COMPOSE_CMD run --rm php82 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php83 ./run-tests.sh $@ $COMPOSE_CMD run --rm php83 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php84 ./run-tests.sh $@

View File

@@ -68,7 +68,7 @@ class PHPUnit_Smarty extends PHPUnit\Framework\TestCase
*/ */
public static function setUpBeforeClass(): void public static function setUpBeforeClass(): void
{ {
error_reporting(E_ALL & ~E_STRICT); error_reporting(E_ALL);
self::$init = true; self::$init = true;
self::$pluginsdir =self::getSmartyPluginsDir(); self::$pluginsdir =self::getSmartyPluginsDir();
} }

View File

@@ -5,10 +5,10 @@ class Smarty_Resource_Filetest extends Smarty_Internal_Resource_File
/** /**
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
parent::populate($source, $_template); parent::populate($source, $_template);
if ($source->exists) { if ($source->exists) {

View File

@@ -12,7 +12,7 @@
class Smarty_Resource_Db4 extends Smarty_Resource class Smarty_Resource_Db4 extends Smarty_Resource
{ {
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$source->filepath = 'db4:'; $source->filepath = 'db4:';
$source->uid = sha1($source->resource); $source->uid = sha1($source->resource);

View File

@@ -38,10 +38,10 @@ class Smarty_Resource_Ambiguous extends Smarty_Internal_Resource_File
/** /**
* populate Source Object with meta data from Resource * populate Source Object with meta data from Resource
* *
* @param Smarty_Template_Source $source source object * @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object * @param Smarty_Internal_Template|null $_template template object
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$segment = ''; $segment = '';
if ($this->segment) { if ($this->segment) {

View File

@@ -12,7 +12,7 @@
class Smarty_Resource_Db extends Smarty_Resource_Recompiled { class Smarty_Resource_Db extends Smarty_Resource_Recompiled {
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) { public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null) {
$source->filepath = 'db:'; $source->filepath = 'db:';
$source->uid = sha1($source->resource); $source->uid = sha1($source->resource);
$source->timestamp = 1000000000; $source->timestamp = 1000000000;

View File

@@ -12,7 +12,7 @@
class Smarty_Resource_Db2 extends Smarty_Resource_Recompiled class Smarty_Resource_Db2 extends Smarty_Resource_Recompiled
{ {
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$source->filepath = 'db2:'; $source->filepath = 'db2:';
$source->uid = sha1($source->resource); $source->uid = sha1($source->resource);

View File

@@ -12,7 +12,7 @@
class Smarty_Resource_Db3 extends Smarty_Resource class Smarty_Resource_Db3 extends Smarty_Resource
{ {
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$source->filepath = 'db3:'; $source->filepath = 'db3:';
$source->uid = sha1($source->resource); $source->uid = sha1($source->resource);

View File

@@ -12,7 +12,7 @@
class Smarty_Resource_Db4 extends Smarty_Resource class Smarty_Resource_Db4 extends Smarty_Resource
{ {
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, ?Smarty_Internal_Template $_template = null)
{ {
$source->filepath = 'db4:'; $source->filepath = 'db4:';
$source->uid = sha1($source->resource); $source->uid = sha1($source->resource);

View File

@@ -152,10 +152,10 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testAllowedModifier1() public function testAllowedModifier1()
{ {
error_reporting(E_ALL & E_STRICT); error_reporting(E_ALL);
$this->smarty->security_policy->allowed_modifiers = array('capitalize'); $this->smarty->security_policy->allowed_modifiers = array('capitalize');
$this->assertEquals("Hello World", $this->smarty->fetch('string:{"hello world"|capitalize}')); $this->assertEquals("Hello World", $this->smarty->fetch('string:{"hello world"|capitalize}'));
error_reporting(E_ALL | E_STRICT); error_reporting(E_ALL);
} }
public function testAllowedModifier2() public function testAllowedModifier2()

View File

@@ -0,0 +1,10 @@
FROM php:8.4-rc-cli-bullseye
## 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