[wp-trac] [WordPress Trac] #59827: wp_save_post_revision() assumes ALL post meta is text! Fatal error in PHP 8.2.

WordPress Trac noreply at wordpress.org
Tue Nov 7 17:31:11 UTC 2023


#59827: wp_save_post_revision() assumes ALL post meta is text! Fatal error in PHP
8.2.
-------------------------------+-----------------------------
 Reporter:  jsmoriss           |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Revisions          |    Version:  6.3.2
 Severity:  blocker            |   Keywords:
  Focuses:  php-compatibility  |
-------------------------------+-----------------------------
 The wp_save_post_revision() function assumes that ALL post meta is text:

 https://github.com/WordPress/wordpress-develop/blob/6.3/src/wp-
 includes/revision.php#L164

 When using register_meta() with 'revisions_enabled' => true to register
 post meta that is an array, it causes a fatal error in PHP 8.2:

 {{{
 PHP Fatal error: Uncaught TypeError: trim():
 Argument #1 ($string) must be of type string, array given in /.../wp-
 includes/formatting.php:5486
 }}}

 Since registering post meta is announced for WP 6.4 (see
 https://make.wordpress.org/core/2023/10/24/framework-for-storing-
 revisions-of-post-meta-in-6-4/), it's a pretty serious problem.

 I've tested the issue on WP 6.3.2 and WP 6.4 (although the footer says
 6.5-alpha-57075).

 js.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59827>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list