Commit 060403ba5c for wordpress.org
commit 060403ba5c339ac9826a6acaceb5ac5902ac5b13
Author: Weston Ruter <weston@xwp.co>
Date: Fri Dec 12 05:08:28 2025 +0000
Revisions: Prevent fatal error in PHP 8+ when saving a post revision with revisioned non-scalar post meta.
Developed in https://github.com/WordPress/wordpress-develop/pull/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: http://core.svn.wordpress.org/trunk@60684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/revision.php b/wp-includes/revision.php
index a2267fcbf8..f292ad9150 100644
--- a/wp-includes/revision.php
+++ b/wp-includes/revision.php
@@ -187,7 +187,7 @@ function wp_save_post_revision( $post_id ) {
$post_has_changed = false;
foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
- if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $latest_revision->$field ) ) {
+ if ( normalize_whitespace( maybe_serialize( $post->$field ) ) !== normalize_whitespace( maybe_serialize( $latest_revision->$field ) ) ) {
$post_has_changed = true;
break;
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 08baf3dad9..2de9d77bb2 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61371';
+$wp_version = '7.0-alpha-61372';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.