• Resolved zarino

    (@zarino)


    While testing out the new 4.3.2 release, I noticed that (unlike in 4.3.1) when Helpful attempts to render without any votes having been cast (ie: an entirely empty wp_helpful database table), it generates a bunch of errors:

    <br />
    <b>Notice</b>:  Trying to get property 'pro' of non-object in <b>/home/vagrant/wordpress/wp-content/plugins/helpful/core/classes/class-helpful-helper-values.php</b> on line <b>341</b><br />
    <br />
    <b>Notice</b>:  Trying to get property 'contra' of non-object in <b>/home/vagrant/wordpress/wp-content/plugins/helpful/core/classes/class-helpful-helper-values.php</b> on line <b>343</b><br />
    <br />
    <b>Notice</b>:  Trying to get property 'pro' of non-object in <b>/home/vagrant/wordpress/wp-content/plugins/helpful/core/classes/class-helpful-helper-values.php</b> on line <b>341</b><br />
    <br />
    <b>Notice</b>:  Trying to get property 'contra' of non-object in <b>/home/vagrant/wordpress/wp-content/plugins/helpful/core/classes/class-helpful-helper-values.php</b> on line <b>343</b><br />
    <br />
    <b>Notice</b>:  Trying to get property 'pro' of non-object in <b>/home/vagrant/wordpress/wp-content/plugins/helpful/core/classes/class-helpful-helper-values.php</b> on line <b>341</b><br />
    <br />
    <b>Notice</b>:  Trying to get property 'contra' of non-object in <b>/home/vagrant/wordpress/wp-content/plugins/helpful/core/classes/class-helpful-helper-values.php</b> on line <b>343</b><br />
    <br />
    <b>Notice</b>:  Trying to get property 'pro' of non-object in <b>/home/vagrant/wordpress/wp-content/plugins/helpful/core/classes/class-helpful-helper-values.php</b> on line <b>341</b><br />
    <br />
    <b>Notice</b>:  Trying to get property 'contra' of non-object in <b>/home/vagrant/wordpress/wp-content/plugins/helpful/core/classes/class-helpful-helper-values.php</b> on line <b>343</b><br />
    <div class="sidebar-widget">
      <div class="textwidget">
        <div class="helpful ">
          <div class="helpful-header">
            <h3 class="helpful-headline"></h3>
          </div><!-- .helpful-header -->
          <div class="helpful-content" role="alert">
            <span></span>
          </div><!-- .helpful-content -->
          <div class="helpful-controls">
            <div>
              <button class="helpful-pro helpful-button" type="button" data-value="pro" data-post="7" role="button">0</button>
            </div>
            <div>
              <button class="helpful-contra helpful-button" type="button" data-value="contra" data-post="7" role="button">0</button>
            </div>
          </div><!-- .helpful-controls -->
        </div><!-- .helpful -->
      </div>
    </div>

    It looks like $results on line 339 of class-helpful-helper-values.php is NULL. In my case, the SQL query it’s just run at that point is:

    
    SELECT pro, contra FROM wp_helpful WHERE user = '4d786868c1fdec18cc82ceab53353166' AND post_id = 7 LIMIT 1
    

    Looks like valid SQL to me, but when the wp_helpful table is empty, this query causes $wpdb->get_row to return NULL.

    It looks like you can get round the problem by casting at least one vote on a page. But I figured I’d report the bug anyway.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Pixelbart

    (@pixelbart)

    @zarino

    Thank you for all your feedback and also the good error messages. With this you help me!

    I will put this into the next update and check the dashboard widget to see if there is any data!

    I’ll write you here as soon as I have done an update. But in the next update this should be fixed!

    Thread Starter zarino

    (@zarino)

    No worries! Thanks for the brilliant plugin!

    Plugin Author Pixelbart

    (@pixelbart)

    @zarino

    Should be fixed with version 4.4.0 We can now continue writing at Github. I always look there now!

    Thread Starter zarino

    (@zarino)

    @pixelbart Don’t know whether this is just a bug affecting users with cookies and sessions disabled, or what, but the 4.4.0 update is causing PHP-FPM to crash on my web server, bringing the site down whenever the plugin updates:

    https://github.com/pixelbart/helpful/issues/9

    Edit: Ah, I see you’ve just responded on GitHub! ??

    • This reply was modified 4 years, 6 months ago by zarino.
    Plugin Author Pixelbart

    (@pixelbart)

    @zarino

    Should be fixed with 4.4.1. We can continue writing on Github. I’m just getting used to having Github always open!

    Thanks for your feedback!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP exceptions if no votes in database’ is closed to new replies.