Skip to content

[5.x]: Plugin settings page only shows error message. #17159

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

Closed
kbergha opened this issue Apr 23, 2025 · 1 comment
Closed

[5.x]: Plugin settings page only shows error message. #17159

kbergha opened this issue Apr 23, 2025 · 1 comment
Labels

Comments

@kbergha
Copy link

kbergha commented Apr 23, 2025

What happened?

Description

Trying to navigate to the plugin settings page in the CP is broken for me.

Steps to reproduce

In the Control panel, go to Settings -> System -> Plugins

Expected behavior

Show plugin settings page.

Actual behavior

I get the following error message:

PHP Deprecated Warning – yii\base\ErrorException
preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Stack trace

yii\base\ErrorException: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /app/vendor/craftcms/cms/src/web/twig/Extension.php:958
Stack trace:
#0 /app/vendor/craftcms/cms/src/web/ErrorHandler.php(115): craft\web\ErrorHandler->handleError(code: '8192', message: ''preg_replace()...', file: ''/app/vendor/cr...', line: '958')
#1 /app/vendor/craftcms/cms/src/web/twig/Extension.php(958): craft\web\ErrorHandler->handleError(code: '8192', message: ''preg_replace()...', file: ''/app/vendor/cr...', line: '958')
#2 /app/vendor/craftcms/cms/src/web/twig/Extension.php(958): ::preg_replace(pattern: ''/.{4}/'', replacement: ''$0-'', subject: 'NULL')
#3 /app/storage/runtime/compiled_templates/fd/fd4e1dcd6e9d74eaec4cf080a3c2985f.php(313): craft\web\twig\Extension->replaceFilter(str: 'NULL', search: ''/.{4}/'', replace: ''$0-'', regex: '???')
#4 /app/vendor/twig/twig/src/Template.php(343): __TwigTemplate_7a72df4414f6f022f5cbc4f7e499d064->block_content(context: '['craft' => cla...', blocks: '['head' => [0 =...')
#5 /app/vendor/twig/twig/src/Template.php(358): __TwigTemplate_7a72df4414f6f022f5cbc4f7e499d064->display(context: '[]', blocks: '???')
#6 /app/vendor/twig/twig/src/TemplateWrapper.php(35): __TwigTemplate_7a72df4414f6f022f5cbc4f7e499d064->render(context: '[]')
#7 /app/vendor/twig/twig/src/Environment.php(320): Twig\TemplateWrapper->render(context: '[]')
#8 /app/vendor/craftcms/cms/src/web/View.php(581): craft\web\twig\Environment->render(name: ''settings/plugi...', context: '[]')
#9 /app/vendor/craftcms/cms/src/web/View.php(634): craft\web\View->renderTemplate(template: ''settings/plugi...', variables: '[]', templateMode: '???')
#10 /app/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\web\View->renderPageTemplate(template: ''settings/plugi...', variables: '[]', templateMode: 'NULL')
#11 /app/vendor/yiisoft/yii2/web/Response.php(1109): craft\web\TemplateResponseFormatter->format(response: 'class craft\\web...')
#12 /app/vendor/craftcms/cms/src/web/Response.php(341): craft\web\Response->prepare()
#13 /app/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()
#14 /app/vendor/yiisoft/yii2/base/Application.php(390): craft\web\Response->send()
#15 /app/web/index.php(12): craft\web\Application->run()
#16 {main}

Image

Potential relevant customization of bootstrap.php:

// Load license key from environment variable
$key = getenv('LICENSE_KEY_CRAFT') ?? null;
if ($key) {
    define('CRAFT_LICENSE_KEY', base64_decode($key));
} else {
    define('CRAFT_LICENSE_KEY', 'could-not-find-key-in-env');
}

We have several LICENSE_KEY_* defined, but this is the only one base64 encoded.
Even if this was misconfigured or missing, the page should still load.

Image

Craft CMS version

5.7.2

PHP version

8.3.19

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

  • Amazon S3 2.2.2
  • Amazon SES 3.1.0
  • Blitz 5.10.4
  • Blitz CloudFront Purger 5.2.0
  • CKEditor 4.7.0
  • Retour 5.0.10
  • SEOmatic 5.1.12
  • Vite 5.0.1
@brandonkelly
Copy link
Member

Thanks for reporting that. Craft 4.15.2 and 5.7.3 are out with a fix for that particular deprecation warning.

Worth mentioning that Craft does attempt to suppress PHP deprecation warnings, so they don’t display in the browser:

cms/bootstrap/bootstrap.php

Lines 159 to 160 in c55baf9

$errorLevel = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED;
error_reporting($errorLevel);

Perhaps calling error_reporting() isn’t allowed on your server, or a plugin/module is overriding Craft’s value later on in the request.

It would be good to track that down, because there are likely to be additional deprecation warnings that crop up, especially shortly after upgrading PHP on your server down the road.

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

No branches or pull requests

2 participants