WordPress结账页面出现Array to string conversion警告的问题求助
WordPress结账页面出现Array to string conversion警告的问题求助
大家好,我最近在做大学作业的项目,用WordPress搭配主题模板搭建网站,本来一切都挺顺利的,结果在访问结账页面的时候突然弹出了这个警告:
"Warning: Array to string conversion in C:\xampp\htdocs\keebid\wp-includes\formatting.php on line 1108"
我把报错位置的相关代码贴出来,麻烦各位帮忙看看问题出在哪:
function wp_check_invalid_utf8( $text, $strip = false ) { $text = (string) $text; if ( 0 === strlen( $text ) ) { return ''; } // Store the site charset as a static to avoid multiple calls to get_option(). static $is_utf8 = null; if ( ! isset( $is_utf8 ) ) { $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ); } if ( ! $is_utf8 ) { return $text; } // Check for support for utf8 in the installed PCRE library once and store the result in a static. static $utf8_pcre = null; if ( ! isset( $utf8_pcre ) ) { // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged $utf8_pcre = @preg_match( '/^./u', 'a' ); } if ( ! $utf8_pcre ) { return $text; } // Check if the text contains invalid UTF-8. if ( ! preg_match( '/^./us', $text ) ) { $text = wp_encode_string( $text ); if ( $strip && function_exists( 'mb_convert_encoding' ) ) { $text = mb_convert_encoding( $text, 'UTF-8', 'UTF-8' ); } } return $text; }
目前我还没搞清楚到底是哪里传入了数组,导致这个字符串转换的错误,希望有经验的朋友能给我一些排查方向或者解决办法,谢谢啦!
备注:内容来源于stack exchange,提问作者Rendy Arya Kusuma
相关产品推荐
相关产品推荐

