Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#63330 new defect (bug)

PHP deprecated error in meta.php on line 1298

Reported by: klemart3d's profile Klemart3D Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.8
Component: Users Keywords: has-patch
Focuses: Cc:

Description (last modified by sabernhardt)

Hi,

Is there a way to check if $meta_key isn't null at line 1298 of WP 6.8, to prevent to following php error:

[18-Apr-2025 14:43:12 UTC] PHP Deprecated:  preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /.../wp-includes/meta.php on line 1298
[18-Apr-2025 14:43:12 UTC] PHP Fatal error:  Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /.../wp-includes/class-wp-user-query.php:486
Stack trace:
#0 /.../wp-includes/class-wp-user-query.php(486): array_filter(NULL)
#1 /.../wp-includes/class-wp-user-query.php(79): WP_User_Query->prepare_query(Array)
#2 /.../wp-includes/user.php(807): WP_User_Query->__construct(Array)
#3 /.../wp-includes/user.php(1715): get_users(Array)
#4 /.../wp-admin/includes/meta-boxes.php(970): wp_dropdown_users(Array)
#5 /.../wp-admin/includes/template.php(1456): post_author_meta_box(Object(WP_Post), Array)
#6 /.../wp-admin/edit-form-advanced.php(722): do_meta_boxes(Object(WP_Screen), 'normal', Object(WP_Post))
#7 /.../wp-admin/post.php(206): require('/home...')
#8 {main} thrown in /.../wp-includes/class-wp-user-query.php on line 486

PHP version: 8.3.9

Change History (2)

This ticket was mentioned in PR #8721 on WordPress/wordpress-develop by @infosatech.


3 weeks ago
#1

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/63330

  • Fix: skip non-array role capabilities in WP_User_Query
  • Fix: handle empty meta key in is_protected_meta function

#2 @sabernhardt
3 weeks ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.