Fatal Error on Edit Profile page
-
Hi, this appeared on the user edit profile page in the backend of WP:
Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, bool given in /web/wp-content/plugins/pie-register/classes/profile_admin.php:552 Stack trace: #0 /web/wp-includes/class-wp-hook.php(324): Profile_admin->edit_user_profile() #1 /web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #2 /web/wp-includes/plugin.php(517): WP_Hook->do_action() #3 /web/wp-admin/user-edit.php(891): do_action() #4 {main} thrown in /web/wp-content/plugins/pie-register/classes/profile_admin.php on line 552The function
sizeof()
is being used on$this->data
in profile_admin.php (line 552), but sometimes$this->data
isfalse
instead of an array. This happens whengetCurrentFields($this->regFormForFreeVers())
returnsfalse
, causing a TypeError becausesizeof()
only works on arrays or countable objects.Potential solution that worked for me:
Update line 552 to first check if
$this->data
is an array before usingcount()
.Fixed Code:
if (is_array($this->data) && count($this->data) > 0)
This prevents the error by ensuring
count()
is only used on an actual array.
- You must be logged in to reply to this topic.