我的错误日志中有以下内容:
[2019年3月26日10:40:42 UTC] PHP警告:/ home / youstable / public_html / blog / wp-content / plugins / js_composer / include / classes / editors / class中的非法字符串偏移量'content' -vc-frontend-editor.php行912
这是引起警告的代码:
function parseShortcodesString( $content, $is_container = false, $parent_id = false ) {
$string = '';
preg_match_all( '/' . self::shortcodesRegexp() . '/', trim( $content ), $found );
WPBMap::addAllMappedShortcodes();
add_shortcode( 'vc_container_anchor', 'vc_container_anchor' );
if ( count( $found[2] ) === 0 ) {
return $is_container && strlen( $content ) > 0 ? $this->parseShortcodesString( '[vc_column_text]' . $content . '[/vc_column_text]', false, $parent_id ) : $content;
}
foreach ( $found[2] as $index => $s ) {
$id = md5( time() . '-' . $this->tag_index ++ );
$content = $found[5][ $index ];
$shortcode = array(
'tag' => $s,
'attrs_query' => $found[3][ $index ],
'attrs' => shortcode_parse_atts( $found[3][ $index ] ),
'id' => $id,
'parent_id' => $parent_id,
);
if ( false !== WPBMap::getParam( $s, 'content' ) ) {
$shortcode['attrs']['content'] = $content; // Line 912
}
$this->post_shortcodes[] = rawurlencode( json_encode( $shortcode ) );
$string .= $this->toString( $shortcode, $content );
}
return $string;
}
912行是
$shortcode['attrs']['content'] = $content;