• Hi,

    I am writing this in shell;

    sudo tail -100 /var/log/apache2/error.log

    And, I saw this;

    ……

    [Sun Feb 14 09:42:06.873076 2021] [php7:warn] [pid 1968] [client 82.222.237.83:36955] PHP Warning: ltrim() expects parameter 1 to be string, object given in /var/www/html/wp-includes/formatting.php on line 4314

    [Sun Feb 14 09:42:06.873149 2021] [php7:warn] [pid 1968] [client 82.222.237.83:36955] PHP Warning: ltrim() expects parameter 1 to be string, object given in /var/www/html/wp-includes/formatting.php on line 4314

    I’m going to the relevant code. –> /var/www/html/wp-includes/formatting.php on line 4314;

    function esc_url( $url, $protocols = null, $_context = 'display' ) {
        $original_url = $url;
    
        if ( '' === $url ) {
            return $url;
        }
    
        $url = str_replace( ' ', '%20', ltrim( $url ) );
        $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url );
    
        if ( '' === $url ) {
            return $url;
        }
    
        if ( 0 !== stripos( $url, 'mailto:' ) ) {
            $strip = array( '%0d', '%0a', '%0D', '%0A' );
            $url   = _deep_replace( $strip, $url );
        }
    
        $url = str_replace( ';//', '://', $url );

    on line 4314;

    $url = str_replace( ' ', '%20', ltrim( $url ) );

    I did not understand. My error page is full of this. I could not figure out despite my research. Can you help me?

    Note: Ubuntu 20.04, WordPress, Digitalocean

    Healthy days, Best regards.

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘PHP Warning: ltrim() Problem in WordPress (formatting.php)’ is closed to new replies.