• Moderator Yui

    (@fierevere)


    永子

    Hi.
    error logs are full of this:

    PHP message: PHP Warning:  A non-numeric value encountered in /wp-content/plugins/vkontakte-api/includes/comments.php on line 989
    PHP message: PHP Warning:  A non-numeric value encountered in /wp-content/plugins/vkontakte-api/includes/comments.php on line 1120

    get_postmeta() can return empty string or false in case there is no meta field,
    it needs to be checked

    something like this will suffice:

    <------>public function add_tabs_button_wp() {
    <------><------>global $post;
    <------><------>$vkapi_comm = get_post_meta( $post->ID, 'vkapi_comm', true );
    <------><------>$fbapi_comm = get_post_meta( $post->ID, 'fbapi_comm', true );
    <------><------>if ($fbapi_comm != '' && $fbapi_comm != false) $fappi = (int)($fbapi_comm);
    <------><------>if ($vkapi_comm != '' && $vkapi_comm != false) $vappi = (int)($vkapi_comm);
    <------><------>$comm_wp    = get_comments_number() - $vappi - $fappi;
    <------><------>$text       = __( 'Site', 'vkapi' );
    <------><------>echo "<div>
    <------><------><------>    <button style='white-space:nowrap'
    <------><------><------>            class='submit'
    <------><------><------>            onclick='showWP()'>
    <------><------><------>        {$text} ({$comm_wp})
    <------><------><------>    </button>
    <------><------><------></div>";
    <------>}

    likewise for public function do_non_empty()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The same problem.

    Log:

    PHP Warning: A non-numeric value encountered in /mypath/wp-content/plugins/vkontakte-api/includes/comments.php on line 1119

    Will you update and support your plugin?

    VKontakte API 3.32.5.9
    WordPress 4.9.1
    PHP 7.1.12-3+ubuntu16.04.1+deb.sury.org+1

    • This reply was modified 6 years, 10 months ago by AiratVibe.
    Moderator Yui

    (@fierevere)

    永子

    I think my “code fixes” cause performance slowdown, they silence the warnings of course

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP 7.2 compat’ is closed to new replies.