Warning: Attempt to read property “id” on null […]bp-xprofile-template.php
-
Hi… since updating to PHP8.3 I am seeing the warning
Warning: Attempt to read property "id" on null in /home/[...]/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-template.php on line 558Any idea what’s up, please?
WP 6.7
BP 14.2.1
PHP 8.3
-
Hi,
It is difficult tell since the error message is missing backtrace info. Furthermore, I’m not getting that error with:
- WP 6.7
- BP 14.2.1
- PHP 8.3
Just for GP and long story short, I placed the function
bp_get_the_profile_field_id();in functions.php of a child theme in an attempt to replicate the error. Query Monitor revealed the error was caused by the aforementioned function, see the following screenshot:I am still seeing this error when editing the extended profile.
Now on:
WP 6.9.4
BP 2.6.4
PHP version 8.3.30The following error now has trace back:
Warning: Attempt to read property "id" on null in /home/<xxx>/public_html/ovni-owners/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-template.php on line 558 Timestamp: 2026-04-20 17:13:41 UTC Stack Trace ----------- 1. bp_get_the_profile_field_id('22') /home/<xxx>/public_html/ovni-owners/wp-content/plugins/ovni-oddments/ovni-oddments.php:213 2. ovni_remove_rich_text(false) /home/<xxx>/public_html/ovni-owners/wp-includes/class-wp-hook.php:343 3. WP_Hook->apply_filters(false, Array(2)) /home/<xxx>/public_html/ovni-owners/wp-includes/plugin.php:205 4. apply_filters('bp_xprofile_is_richtex...', false, 36) /home/<xxx>/public_html/ovni-owners/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-functions.php:1217 5. bp_xprofile_is_richtext_enabled_for_field(36) /home/<xxx>/public_html/ovni-owners/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-filters.php:138 6. xprofile_filter_kses('Welsh coast', BP_XProfile_ProfileData) /home/<xxx>/public_html/ovni-owners/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-filters.php:225 7. xprofile_sanitize_data_value_before_save('Welsh coast', null, true, BP_XProfile_ProfileData) /home/<xxx>/public_html/ovni-owners/wp-includes/class-wp-hook.php:341 8. WP_Hook->apply_filters('Welsh coast', Array(4)) /home/<xxx>/public_html/ovni-owners/wp-includes/plugin.php:205 9. apply_filters('xprofile_data_value_be...', 'Welsh coast', null, true, BP_XProfile_ProfileData) /home/<xxx>/public_html/ovni-owners/wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-xprofile-profiledata.php:222 10. BP_XProfile_ProfileData->save() /home/<xxx>/public_html/ovni-owners/wp-content/plugins/buddypress/bp-xprofile/bp-xprofile-functions.php:526 11. xprofile_set_field_data(BP_XProfile_ProfileData, 441, 'Welsh coast', false) /home/kiivmr5gzlfz/public_html/ovni-owners/wp-content/plugins/buddypress/bp-xprofile/classes/class-bp-xprofile-user-admin.php:209 12. BP_XProfile_User_Admin->user_admin_load('update', 441, Array(67), '/wp-admin/users.php?pa...') /home/<xxx>/public_html/ovni-owners/wp-includes/class-wp-hook.php:341 13. WP_Hook->apply_filters(null, Array(4)) /home/<xxx>/public_html/ovni-owners/wp-includes/class-wp-hook.php:365 14. WP_Hook->do_action(Array(4)) /home/<xxx>/public_html/ovni-owners/wp-includes/plugin.php:570 15. do_action_ref_array('bp_members_admin_updat...', Array(4)) /home/<xxx>/public_html/ovni-owners/wp-content/plugins/buddypress/bp-members/classes/class-bp-members-admin.php:1159 16. BP_Members_Admin->user_admin_load('') /home/<xxx>/public_html/ovni-owners/wp-includes/class-wp-hook.php:341 17. WP_Hook->apply_filters('', Array(1)) /home/<xxx>/public_html/ovni-owners/wp-includes/class-wp-hook.php:365 18. WP_Hook->do_action(Array(1)) /home/<xxx>/public_html/ovni-owners/wp-includes/plugin.php:522 19. do_action('load-users_page_bp-pro...') /home/<xxx>/public_html/ovni-owners/wp-admin/admin.php:242 20. require_once('/home/<xxx>/pub...') /home/<xxx>/public_html/ovni-owners/wp-admin/users.php:11 Context ------- URL : /wp-admin/users.php?page=bp-profile-edit&user_id=441&wp_http_referer=%2Fwp-admin%2Fusers.php%3Fid%3D441&action=update Referer : https://ovni-owners.org.uk/wp-admin/users.php?page=bp-profile-edit&user_id=441&wp_http_referer=%2Fwp-admin%2Fusers.php%3Fid%3D441 HTTP Method : POST HTTP Host : ovni-owners.org.uk HTTP Status : 200 isSSL : Yes Current Filter : load-users_page_bp-profile-edit, bp_members_admin_update_user, xprofile_data_value_before_save, bp_xprofile_is_richtext_enabled_for_field Execution Time : 3.062 s Memory Usage : 131.99 MiB PHP SAPI : litespeedWhoops – hold off responding to this for now. I may have found the cause.
Closing this topic. I have found it is caused by a filter of my own :-#)
- The topic ‘Warning: Attempt to read property “id” on null […]bp-xprofile-template.php’ is closed to new replies.
