Skip to content

Error while deleting joomla user in backend cause by JoomCCK #448

Description

@Giorgi625

Below is audit details done by Claude :
Bug Report: PHP 8 fatal error when deleting a user (implode argument order)

Summary

Deleting any user from the Joomla administrator fails with a fatal TypeError on PHP 8.0+. The JoomCCK system plugin's user-deletion cleanup routine calls implode() using the pre-PHP-8 argument order (array first, separator second), which was removed in PHP 8.0.

Affected file

plugins/system/joomcck/joomcck.php

The bug is in the handler that runs on Joomla's user-delete event, which deletes the user's records across all JoomCCK tables.

Error message

implode(): Argument #1 ($separator) must be of type string, array given

Stack trace (example):

Uncaught Throwable of type TypeError thrown with message
"implode(): Argument #1 ($separator) must be of type string, array given".
Stack trace: #0 [ROOT]/plugins/system/joomcck/joomcck.php(156): implode(Array, ',')

Root cause

PHP's implode() historically accepted arguments in either order. The legacy form implode($array, $separator) was deprecated in PHP 7.4 and removed in PHP 8.0. Since PHP 8.0, only the documented signature is valid:

phpimplode(string $separator, array $array)

The plugin uses the removed legacy order. On PHP 7.x it ran without error; on PHP 8.0+ it throws a fatal TypeError, so the user deletion cannot complete.

When it triggers

Any time an administrator deletes a user, because the cleanup routine fires on the user-delete event and runs these implode() calls to build the list of record IDs to remove from each JoomCCK table.

The fix

Swap the two arguments so the separator comes first. For every affected call:

php// Before (removed in PHP 8.0 — causes the fatal error)
implode($records, ',')

// After (correct PHP 8 signature)
implode(',', $records)

The variable name and separator stay the same — only the argument order changes.

Scope

There are 14 implode() calls in this routine. 13 use the wrong order and need the swap; one was already correct. Each corresponds to clearing the deleted user's records from one JoomCCK table:

Table#__js_res_audit_restore#__js_res_audit_versions#__js_res_comments#__js_res_favorite#__js_res_hits#__js_res_notifications#__js_res_record_category#__js_res_record_repost#__js_res_record_values#__js_res_sales#__js_res_subscribe#__js_res_tags_history#__js_res_vote

Suggested action

Update all affected implode() calls to the implode($separator, $array) order and ship in the next release. This is the only change required; behaviour is identical on PHP 7.x and is restored on PHP 8.0+.

Environment

JoomCCK system plugin (plugins/system/joomcck/joomcck.php)
PHP 8.0 or newer
Triggered by: deleting a user in the Joomla administrator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions