-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Plugin version: 6.75
PHP version: 8.1 / 8.3
WordPress version: 6.x
Description
AltSessions.php:227 triggers an "Array to string conversion" warning when $value is an array and the type annotation is string.
The warning fires on every POST /wp-json/cleantalk-antispam/v1/alt_sessions request where the cookie value happens to be an array.
Steps to reproduce
- Visit a page with CleanTalk active
- A
POST /wp-json/cleantalk-antispam/v1/alt_sessionsrequest fires - If any cookie value is an array, the
(string)$valuecast on line 227 triggers the warning
Location
lib/Cleantalk/ApbctWP/Variables/AltSessions.php, line 227:
case 'string':
$cookies_array[$name] = (string)$value;
break;Suggested fix
Check if $value is an array before casting:
case 'string':
$cookies_array[$name] = is_array($value) ? wp_json_encode($value) : (string)$value;
break;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels