Changes between Initial Version and Version 1 of Ticket #64314, comment 5
- Timestamp:
- 12/12/2025 01:47:42 AM (5 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #64314, comment 5
initial v1 7 7 When saving a post that contains array/object postmeta, the editor displays “Updating failed.” and the REST API request returns an HTTP 500 error. The PHP error log shows the following fatal error: 8 8 9 {{{ 9 10 [29-Nov-2025 14:44:42 UTC] PHP Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /var/www/html/wordpress-test/wp-includes/formatting.php:5499 10 11 Stack trace: … … 31 32 #20 {main} 32 33 thrown in /var/www/html/wordpress-test/wp-includes/formatting.php on line 5499 34 }}} 33 35 34 36 This confirms the issue described in this ticket: normalize_whitespace() calls trim(), which only accepts strings, but receives an array from $post->$field in wp_save_post_revision(). … … 36 38 After applying the proposed fix from PR 10560 and updating the comparison to serialize the values: 37 39 40 {{{#!php 41 <?php 38 42 foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) { 39 43 if ( normalize_whitespace( serialize( $post->$field ) ) !== normalize_whitespace( serialize( $latest_revision->$field ) ) ) { … … 42 46 } 43 47 } 48 49 }}} 50 44 51 45 52 the fatal error no longer occurs.