Support » Plugin: WP ULike » PHP Catchable fatal error: WP_Error could not be converted to string

  • Resolved shmsl

    (@shmsl)


    Since we updated to 4.0.0 when non-logged-in users submit a comment, they just see an error message and the comment will not be posted.

    PHP log:

    PHP Catchable fatal error: Object of class WP_Error could not be converted to string in /var/www/web_1712_1/htdocs/live/wp-content/plugins/wp-ulike/inc/general-functions.php on line 1864

    We did a var_dump($num) on line 1864 and got:

    object(WP_Error)#12449 (2) {
      ["errors"]=> array(1) {
        ["broke"]=> array(1) {
          [0]=> string(47) "Please enter some value for required variables."
        }
      }
      ["error_data"]=> array(0) { }
    }

    So our temporary workaround was:

    if (is_a($num, "WP_Error")) {
      $value = '';
    } else {
      $value = $num . $sign;
    }
    • This topic was modified 1 month, 2 weeks ago by shmsl.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.