No Code Attached Yet bug
avatar Dirk-K
Dirk-K
15 Jul 2026

What happened?

Joomla Version 6.1.2
PHP Version 8.4.x

Problem Description

The default Cassiopeia template (templates/cassiopeia/offline.php) calls str_replace() on the value returned by:

$app->get('offline_message')

If no offline message has been configured, this value is null.

With PHP 8.4 this results in the following deprecated warning:

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

The affected code is:

get('display_offline_message', 1) == 1 && str_replace(' ', '', $app->get('offline_message')) != '') : ?>

Steps to reproduce
Install Joomla 6.1.2.
Use PHP 8.4.
Enable Offline Mode.
Leave the "Offline Message" field empty.
Open the offline page.

Version

6.1

Expected result

No deprecated warnings should be generated.

Actual result

PHP outputs:

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

System Information

No response

Additional Comments

Suggested fix:

Cast the value to a string before passing it to str_replace():

str_replace(' ', '', (string) $app->get('offline_message'))

or, even better, use trim() since the code is only checking whether the message is empty:

trim((string) $app->get('offline_message')) !== ''

This avoids the PHP 8.4 deprecation warning and more clearly expresses the intended logic.

avatar Dirk-K Dirk-K - open - 15 Jul 2026
avatar Dirk-K Dirk-K - change - 15 Jul 2026
Labels Added: bug
avatar Dirk-K Dirk-K - labeled - 15 Jul 2026
avatar joomla-cms-bot joomla-cms-bot - change - 15 Jul 2026
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Jul 2026
avatar richard67
richard67 - comment - 15 Jul 2026

Does it also happen with Joomla 5.4.7?

Add a Comment

Login with GitHub to post a comment