Skip to content

Commit 04fe511

Browse files
committed
Revisions: Prevent fatal error in PHP 8+ when saving a post revision with revisioned non-scalar post meta.
Developed in WordPress/wordpress-develop#10560 Follow-up to [56714]. Props LAPSrj, manhphucofficial, westonruter. See #20299. Fixes #64314. Built from https://develop.svn.wordpress.org/trunk@61372 git-svn-id: https://core.svn.wordpress.org/trunk@60684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent ca4d0f7 commit 04fe511

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

wp-includes/revision.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function wp_save_post_revision( $post_id ) {
187187
$post_has_changed = false;
188188

189189
foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
190-
if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $latest_revision->$field ) ) {
190+
if ( normalize_whitespace( maybe_serialize( $post->$field ) ) !== normalize_whitespace( maybe_serialize( $latest_revision->$field ) ) ) {
191191
$post_has_changed = true;
192192
break;
193193
}

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.0-alpha-61371';
19+
$wp_version = '7.0-alpha-61372';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)