[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 18:01:49 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: normal | Resolution:
Keywords: | Focuses: php-compatibility
--------------------------+--------------------------------
Changes (by jsmoriss):
* keywords: reporter-feedback =>
* focuses: => php-compatibility
Comment:
Replying to [comment:7 jorbin]:
> @jsmoriss do you have code that demonstrates the issue?
Adding an error_log() to the foreach() loop:
https://github.com/WordPress/wordpress-develop/blob/6.3/src/wp-
includes/revision.php#L163-L168
{{{
foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
error_log( 'comparing ' . $field . ' values of type ' . gettype(
$post->$field ) );
if ( normalize_whitespace( $post->$field ) !== normalize_whitespace(
$latest_revision->$field ) ) {
$post_has_changed = true;
break;
}
}
}}}
Produces the following error when saving a post/page:
{{{
[07-Nov-2023 17:57:40 UTC] comparing post_title values of type string
[07-Nov-2023 17:57:40 UTC] comparing post_content values of type string
[07-Nov-2023 17:57:40 UTC] comparing post_excerpt values of type string
[07-Nov-2023 17:57:40 UTC] comparing footnotes values of type string
[07-Nov-2023 17:57:40 UTC] comparing _wpsso_meta values of type array
[07-Nov-2023 17:57:40 UTC] PHP Warning: trim() expects parameter 1 to be
string, array given in /var/www/wpadm/wordpress/wp-includes/formatting.php
on line 5486
[07-Nov-2023 17:57:40 UTC] PHP Warning: trim() expects parameter 1 to be
string, array given in /var/www/wpadm/wordpress/wp-includes/formatting.php
on line 5486
}}}
js.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59827#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list