PHP exceptions if no votes in database
-
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 ofclass-helpful-helper-values.php
isNULL
. 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)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘PHP exceptions if no votes in database’ is closed to new replies.