• Hi there,

    I’ve been getting the following error:

    [05-Dec-2018 17:50:07 UTC] PHP Warning: json_decode() expects parameter 1 to be string, array given in /wp-content/plugins/wp-statistics/includes/classes/class-wp-statistics-rest.php on line 112

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mostafa Soufi

    (@mostafas1990)

    Please open that file and use the below function

    static public function params( $params ) {
        if ( isset( $_POST[ self::_POST ] ) ) {
            $data = wp_unslash( $_POST[ self::_POST ] );
    
            if(is_object($data)) {
                $data = json_decode( $data, true );
            }
    
            if ( isset( $data[ $params ] ) ) {
                return $data[ $params ];
            }
        }
    
        return false;
    }

    Keet me informed about the test.

    Thread Starter Venutius

    (@venutius)

    Thanks,

    I’ve updated the function, no error so far, only I’ve not had that error fora day or so, so it’s not triggering too often. I’d say we give it a week and if there are no errors then we call it fixed.

    Plugin Author Mostafa Soufi

    (@mostafas1990)

    Could you please tell me what is your website address?

    I’ll check the REST API request.

    Thread Starter Venutius

    (@venutius)

    it’s truthofself.com, I’ve got REST disabled

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘json_decode90 expects parameter 1 to be a string’ is closed to new replies.