How to solve the error Uninitialized string offset: 0 in?

0

Using a wordpress plugin the yoast ends up giving this error in some posts, a post that is giving error is:

link

in it we can see the message:

  

"Notice: Uninitialized string offset: 0 in   /home/escolaedti/public_html/wp-content/plugins/wordpress-seo/frontend/class-twitter.php   on line 495 "

I copied the snippet where it says where the error is.

protected function image_output( $img, $tag = false ) {
        if ( $tag ) {
            _deprecated_argument( __METHOD__, 'WPSEO 2.4' );
        }
        /**
         * Filter: 'wpseo_twitter_image' - Allow changing the Twitter Card image
         *
         * @api string $img Image URL string
         */
        $img = apply_filters( 'wpseo_twitter_image', $img );
        if ( WPSEO_Utils::is_url_relative( $img ) === true && $img[0] === '/' ) {
            $parsed_url = wp_parse_url( home_url() );
            $img        = $parsed_url['scheme'] . '://' . $parsed_url['host'] . $img;
        }
        $escaped_img = esc_url( $img );
        if ( in_array( $escaped_img, $this->shown_images, true ) ) {
            return false;
        }
        if ( is_string( $escaped_img ) && $escaped_img !== '' ) {
            $this->output_metatag( 'image', $escaped_img, true );
            array_push( $this->shown_images, $escaped_img );
            return true;
        }
        return false;
    }

line 495:

if ( WPSEO_Utils::is_url_relative( $img ) === true && $img[0] === '/' ) {

I noticed this error after we started switching from http to https.

    
asked by anonymous 24.05.2018 / 17:26

0 answers