Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing fix for PHP 8.4 on StringEval::populate() #1087

Open
ykawasaki683 opened this issue Nov 29, 2024 · 4 comments
Open

missing fix for PHP 8.4 on StringEval::populate() #1087

ykawasaki683 opened this issue Nov 29, 2024 · 4 comments

Comments

@ykawasaki683
Copy link

I found this error blow.

PHP Deprecated:  Smarty\Resource\StringEval::populate(): Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /var/www/ec2/front/vendor/smarty/smarty/src/Resource/StringEval.php on line 34

This error disappeared by fixing this line like below.

public function populate(\Smarty\Template\Source $source, \Smarty\Template $_template = null)

public function populate(\Smarty\Template\Source $source, ?\Smarty\Template $_template = null)

On this fix, I referred this PR.
#1043

@ilessing
Copy link

I too got a bunch of deprecation warnings about the Implicitly marking parameter $parent as nullable is deprecated

Deprecated: Smarty\TemplateBase::createData():                 Implicitly marking parameter $parent as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/TemplateBase.php on line 185
Deprecated: Smarty\Cacheresource\File::process():              Implicitly marking parameter $cached as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Cacheresource/File.php on line 100
Deprecated: Smarty\Cacheresource\Base::process():              Implicitly marking parameter $cached as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Cacheresource/Base.php on line 45
Deprecated: Smarty\Template::__construct():                    Implicitly marking parameter $_parent as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Template.php on line 115
Deprecated: Smarty\Template::renderSubTemplate():              Implicitly marking parameter $scope as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Template.php on line 244
Deprecated: Smarty\Template::createCodeFrame():                Implicitly marking parameter $compiler as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Template.php on line 465
Deprecated: Smarty\Template\Source::load():                    Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Template/Source.php on line 136
Deprecated: Smarty\Template\Source::load():                    Implicitly marking parameter $smarty as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Template/Source.php on line 136
Deprecated: Smarty\Resource\BasePlugin::populate():            Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Resource/BasePlugin.php on line 115
Deprecated: Smarty\Resource\FilePlugin::populate():            Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Resource/FilePlugin.php on line 35
Deprecated: Smarty\Runtime\InheritanceRuntime::processBlock(): Implicitly marking parameter $parent as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/smarty/smarty/src/Runtime/InheritanceRuntime.php on line 162

I'll try to swing back and make a PR to fix this but if anyone else can do so first so much the better.

@wisskid
Copy link
Member

wisskid commented Dec 27, 2024

The notices occur when there is another optional parameter of mixed type. However, PHP 7 didn't support the mixed keyword, so it seems to me we cannot use ?mixed without dropping support for PHP 7.2, 7.3 and 7.4.

@ilessing
Copy link

To avoid dropping support for older versions of PHP
could we use PHP function version_compare to add a conditional so we could support mixed keyword on systems running PHP >= 8.0 ??

@wisskid
Copy link
Member

wisskid commented Jan 2, 2025

That would require duplicating all classes that have this issue. That's a lot of code duplication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants