From 4f98367fcae3c080eadc72d53e4823c0cad5d79e Mon Sep 17 00:00:00 2001 From: JS Morisset Date: Thu, 9 Nov 2023 08:44:28 -0800 Subject: [PATCH] fix for PHP Fatal error: Uncaught TypeError: trim() --- src/wp-includes/revision.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/revision.php b/src/wp-includes/revision.php index 681d11736c0d1..9d058349d9dd9 100644 --- a/src/wp-includes/revision.php +++ b/src/wp-includes/revision.php @@ -187,7 +187,12 @@ 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 ( is_string( $post->$field ) && is_string( $latest_revision->$field ) ) { + if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $latest_revision->$field ) ) { + $post_has_changed = true; + break; + } + } elseif ( $post->$field !== $latest_revision->$field ) { $post_has_changed = true; break; }