diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php index 42be6ab5d..237c61557 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-settings-page.php @@ -412,7 +412,18 @@ public function sanitize( $setting, $fields ) { } } else { if ( is_array( $field ) ) { - array_walk_recursive( $field, 'sanitize_text_field' ); + array_walk_recursive( + $field, + static function( $field_value ) { + // WP 4.9 compatibility, as _sanitize_text_fields() didn't have this check yet, and this prevents an error. + // @see https://github.com/WordPress/wordpress-develop/blob/b30baca3ca2feb7f44b3615262ca55fcd87ae232/src/wp-includes/formatting.php#L5307 + if ( is_object( $field_value ) || is_array( $field_value ) ) { + return ''; + } + + return sanitize_text_field( $field_value ); + } + ); } else { $setting[ $slug ] = sanitize_text_field( $field ); }