[wp-trac] [WordPress Trac] #63330: PHP deprecated error in meta.php on line 1298

WordPress Trac noreply at wordpress.org
Wed Apr 23 23:36:28 UTC 2025


#63330: PHP deprecated error in meta.php on line 1298
--------------------------+------------------------------
 Reporter:  Klemart3D     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Users         |     Version:  6.8
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------
Description changed by sabernhardt:

Old description:

> Hi,
>
> Is there a way to check if $meta_key isn't null at
> [https://github.com/WordPress/WordPress/blob/master/wp-
> includes/meta.php#L1298 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
> /home/website/www/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
> /home/website/www/wp-includes/class-wp-user-query.php:486
> Stack trace:
> #0 /home/website/www/wp-includes/class-wp-user-query.php(486):
> array_filter(NULL)
> #1 /home/website/www/wp-includes/class-wp-user-query.php(79):
> WP_User_Query->prepare_query(Array)
> #2 /home/website/www/wp-includes/user.php(807):
> WP_User_Query->__construct(Array)
> #3 /home/website/www/wp-includes/user.php(1715): get_users(Array)
> #4 /home/website/www/wp-admin/includes/meta-boxes.php(970):
> wp_dropdown_users(Array)
> #5 /home/website/www/wp-admin/includes/template.php(1456):
> post_author_meta_box(Object(WP_Post), Array)
> #6 /home/website/www/wp-admin/edit-form-advanced.php(722):
> do_meta_boxes(Object(WP_Screen), 'normal', Object(WP_Post))
> #7 /home/website/www/wp-admin/post.php(206): require('/home/website...')
> #8 {main} thrown in /home/website/www/wp-includes/class-wp-user-query.php
> on line 486
>
> PHP version: 8.3.9

New description:

 Hi,

 Is there a way to check if `$meta_key` isn't `null` at
 [https://github.com/WordPress/wordpress-
 develop/blob/05a2999a8daf0da7e21ab94096578e6eb073bedf/src/wp-
 includes/meta.php#L1298 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

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63330#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list