From 4ca672f5c66ab8727bf1d3fcc3f5d7ac990bd8bd Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 20 Aug 2025 12:43:48 -0300 Subject: [PATCH 1/2] Improve support for WP 6.9 --- classes/helpers/FrmAppHelper.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/classes/helpers/FrmAppHelper.php b/classes/helpers/FrmAppHelper.php index 4fdaf8cbba..8638cd5f7d 100644 --- a/classes/helpers/FrmAppHelper.php +++ b/classes/helpers/FrmAppHelper.php @@ -4599,4 +4599,24 @@ public static function no_gdpr_cookies() { $frm_settings = self::get_settings(); return $frm_settings->enable_gdpr && $frm_settings->no_gdpr_cookies; } + + /** + * Check if a string is valid UTF-8. + * + * @since x.x + * + * @param string $string The string to check. + * @return bool + */ + public static function is_valid_utf8( $string ) { + // wp_is_valid_utf8 is added in WP 6.9. + if ( function_exists( 'wp_is_valid_utf8' ) ) { + return wp_is_valid_utf8( $string ); + } + // As of WP 6.9, seems_utf8 is deprecated. + if ( function_exists( 'seems_utf8' ) ) { + return seems_utf8( $string ); + } + return false; + } } From 5d9c24ccfc5d97f648bed8fabcd435233024b6cf Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Wed, 20 Aug 2025 12:45:40 -0300 Subject: [PATCH 2/2] Use the new function --- classes/helpers/FrmXMLHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/helpers/FrmXMLHelper.php b/classes/helpers/FrmXMLHelper.php index 2a78ea95e8..4c63fe1bd2 100644 --- a/classes/helpers/FrmXMLHelper.php +++ b/classes/helpers/FrmXMLHelper.php @@ -1707,7 +1707,7 @@ public static function cdata( $str ) { FrmAppHelper::unserialize_or_decode( $str ); if ( is_array( $str ) ) { $str = json_encode( $str ); - } elseif ( seems_utf8( $str ) === false ) { + } elseif ( FrmAppHelper::is_valid_utf8( $str ) === false ) { $str = FrmAppHelper::maybe_utf8_encode( $str ); }