PHP8.2 compatibility : Fixed unit tests

This commit is contained in:
Progi1984
2022-09-15 15:16:53 +02:00
parent d02ef6652a
commit 892dc33907
4 changed files with 8 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Runtime_Make_Nocache
{ {
if (isset($tpl->tpl_vars[ $var ])) { if (isset($tpl->tpl_vars[ $var ])) {
$export = $export =
preg_replace('/^Smarty_Variable::__set_state[(]|[)]$/', '', var_export($tpl->tpl_vars[ $var ], true)); preg_replace('/^\\\\?Smarty_Variable::__set_state[(]|[)]$/', '', var_export($tpl->tpl_vars[ $var ], true));
if (preg_match('/(\w+)::__set_state/', $export, $match)) { if (preg_match('/(\w+)::__set_state/', $export, $match)) {
throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'"); throw new SmartyException("{make_nocache \${$var}} in template '{$tpl->source->name}': variable does contain object '{$match[1]}' not implementing method '__set_state'");
} }

View File

@@ -206,6 +206,7 @@ class StreamResourceTest extends PHPUnit_Smarty
} }
} }
#[AllowDynamicProperties]
class ResourceStream class ResourceStream
{ {
private $position; private $position;

View File

@@ -391,6 +391,7 @@ class Security extends Smarty_Security
{ {
} }
#[AllowDynamicProperties]
class ResourceStreamSecurity class ResourceStreamSecurity
{ {
private $position; private $position;

View File

@@ -15,6 +15,11 @@
*/ */
class CompileRegisteredObjectFunctionTest extends PHPUnit_Smarty class CompileRegisteredObjectFunctionTest extends PHPUnit_Smarty
{ {
/**
* @var RegObject
*/
private $object;
public function setUp(): void public function setUp(): void
{ {
$this->setUpSmarty(__DIR__); $this->setUpSmarty(__DIR__);