[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
Thu Nov 9 17:49:41 UTC 2023


#59827: wp_save_post_revision() assumes ALL post meta is text! Fatal error in PHP
8.2.
-----------------------------------------+--------------------------------
 Reporter:  jsmoriss                     |       Owner:  adamsilverstein
     Type:  defect (bug)                 |      Status:  assigned
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Revisions                    |     Version:  6.3.2
 Severity:  normal                       |  Resolution:
 Keywords:  reporter-feedback has-patch  |     Focuses:  php-compatibility
-----------------------------------------+--------------------------------

Comment (by jsmoriss):

 Replying to [comment:15 adamsilverstein]:

 > It looks like your plugin returns a string for the
 '_wp_post_revision_field_' . meta_key filter, so it doesn't make sense
 that it triggers this error

 The "'_wp_post_revision_field_' . meta_key" filter is only used for the
 diff shown to users on the revision page.

 The problem is the compare done in wp_save_post_revision() (see
 https://github.com/WordPress/wordpress-develop/blob/6.3/src/wp-
 includes/revision.php#L109) which WordPress uses to determine if a
 revision needs to be saved - it assumes that all post meta are strings.

 > ps. it would be good to add a test here to validate any fix we come up
 with.

 The test plugin creates a PHP error in the current WordPress development
 branch, and no error with the PR.

 js.

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


More information about the wp-trac mailing list