PHP 8.4 Compatibility Issues with Newspaper Theme & td-cloud-library

Posted in: Newspaper
Post count: 16

Dear TagDiv Support,

I am contacting you regarding critical compatibility issues between the Newspaper theme and PHP 8.4, which are affecting the performance and stability of my site (europeantimes.news).

After thorough debugging, I have identified two major issues in the td-cloud-library plugin, which is bundled with your theme.

❌ 1. Deprecated Constructor in Mobile_Detect.php
File:
/wp-content/plugins/td-cloud-library/includes/Mobile_Detect.php

Issue:
The constructor uses implicitly nullable parameters, which is deprecated in PHP 8.4:

php

1
function __construct($userAgent = null, $httpHeaders = null)
Error:

1
PHP Deprecated: Mobile_Detect::__construct(): Implicitly marking parameter $headers as nullable is deprecated
Solution:
Update the constructor to use explicit nullable types:

php

1
function __construct(?string $userAgent = null, ?array $httpHeaders = null)
❌ 2. Text Domain Loaded Too Early
Issue:
The td-cloud-library plugin loads its translations before the init hook, which triggers a WordPress deprecation notice:

1
PHP Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ‘td-cloud-library’ domain was triggered too early.
Cause:
load_plugin_textdomain() is called directly when the plugin loads, not on the init action.

Solution:
Move the text domain loading to the init hook:

php

1
2
3
add_action(‘init’, function() {
load_plugin_textdomain(‘td-cloud-library’, false, dirname(plugin_basename(__FILE__)) . ‘/languages’);
});
✅ Impact
These issues generate hundreds of PHP notices and deprecation warnings
They contribute to performance degradation
They indicate the plugin is not fully compatible with PHP 8.4
🔧 Request
Please:

Provide an updated version of td-cloud-library with PHP 8.4 support
Or confirm if a fix is already available in a newer release
Advise if there are any known conflicts with Redis, WP-CLI, or high-traffic automated sites
I am using:

WordPress 6.8.2
PHP 8.4.6
Redis Object Cache
Newspaper Theme (latest version)
Thank you for your support. I look forward to your response.

Best regards,

Post count: 16

Hello TagDiv Support,

I’m reaching out regarding two critical PHP 8.4 compatibility issues in the td-cloud-library plugin bundled with the Newspaper theme. These are causing repeated deprecation warnings and notices on my site (europeantimes.news), even though the site functions partially.

After thorough debugging, I’ve identified the following issues:

### 1. **Deprecated Constructor in Mobile_Detect.php**

**File:**
/wp-content/plugins/td-cloud-library/includes/Mobile_Detect.php (line 684)

**Issue:**
The constructor uses implicitly nullable parameters, which is deprecated in PHP 8.4:

`php
function __construct($userAgent = null, $httpHeaders = null)
`

This triggers the following error:
`
PHP Deprecated: Mobile_Detect::__construct(): Implicitly marking parameter $headers as nullable is deprecated, the explicit nullable type must be used instead
`

**Recommended Fix:**
Update the constructor to use explicit nullable types:

`php
function __construct(?string $userAgent = null, ?array $httpHeaders = null)
`

### 2. **Text Domain Loaded Too Early**

**Issue:**
The td-cloud-library plugin loads its translations **before the init action**, which triggers a WordPress 6.7+ deprecation notice:

`
PHP Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ‘td-cloud-library’ domain was triggered too early.
`

**Cause:**
load_plugin_textdomain() is called directly when the plugin loads, not within the init hook.

**Recommended Fix:**
Move the translation loading to the init action:

`php
add_action(‘init’, function() {
load_plugin_textdomain(‘td-cloud-library’, false, dirname(plugin_basename(__FILE__)) . ‘/languages’);
});
`

### Environment
– WordPress: 6.8.2
– PHP: 8.4.6
– Theme: Newspaper (latest version)
– Plugin: td-cloud-library (bundled)
– Redis: Active (Redis Object Cache Pro)

### Request
Could you please:
1. Confirm if these issues are known and if a fix is already available?
2. Provide an updated version of td-cloud-library with full PHP 8.4 support?
3. Advise on any known conflicts with Redis or high-traffic automated sites?

These notices are not just noise — they impact performance and indicate deeper compatibility issues.

Thank you for your time and support. I look forward to your response.

Best regards,

Post count: 35449

Hello,

Thank you for bringing this to our attention. Unfortunately, the current theme version is recommended to be used with PHP version 8.3 and has not yet been tested with 8.4. I’ve noted this issue for our developers, and they will check compatibility with the latest PHP version.

Thank you for your patience!

Post count: 9544

FYI, I am using safely with latest 8.3x version of PHP without issues. PHP 8.4 is the “next step” for PHP, but does a bunch of notable changes that may break all kinds of WordPress elements, so not recommended yet. Any web host with PHP 8.4 still supports 8.3x as it’s more common safe to use version in the 8x thread.

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.