pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
391 stars 42 forks source link

Deprecation warning in PHP 8.1 for null values #249

Closed windware-ono closed 2 years ago

windware-ono commented 2 years ago

With PHP 8.1, built-in functions started to raise deprecation warnings when given null for non nullable parameters with the following error.

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated

https://www.php.net/manual/en/migration81.deprecated.php

This seems to happen in,

vendor/pug-php/pug/src/Pug/Engine/Options.php in Pug\Engine\Options::initializeJsPhpize at line 156 for strtolower

    protected function initializeJsPhpize()
    {
        if (strtolower($this->getDefaultOption('expressionLanguage')) !== 'php') {
            $compiler = $this->getCompiler();
            $compiler->addModule(new JsPhpizePhug($compiler));
        }
    }

I could suppress this warning if I explicitly specified 'expressionLanguage' in the initializer but for those who don't, it gets reported on every page access and it can cause excessive amount of warnings.

Thanks.

kylekatarnls commented 2 years ago

Hello,

It's already fixed in master branch. I released a new tag so you can just update and it will be solved.

Thanks.