PHP Notice

May 25, 2016 3:12 pm

I wanted to let you guys know that I am getting a php notice with your premium plugin. I have debug set to true as I am developing the site right now, so I can see any errors or notices. When I do a search on my Woocommerce shop or anywhere that posts can be shown; if the search comes up empty (“No products were found matching your selection”, etc.) then this notice pops up:

“Notice: Trying to get property of non-object in /usr/local/www/apache24/data/wp-content/plugins/gotowp_g2w/_gtwp_g2w_inc.php on line 132

Notice: Trying to get property of non-object in /usr/local/www/apache24/data/wp-content/plugins/gotowp_g2w/_gtwp_g2w_inc.php on line 3956

Notice: Trying to get property of non-object in /usr/local/www/apache24/data/wp-content/plugins/gotowp_g2w/_gtwp_g2w_inc.php on line 150”

I realize this won’t appear when I set debug to false but I like to fix anything that pops up. I went through your code where the errors are occurring and was able to fix it. I thought I would let you know as I don’t want to edit your code. If you add if( !is_object($post) ) to your code it will prevent the notice from occurring. For example line 132 would now look like: if ( !is_object($post) || gotowp_premium_has_shortcode ( ‘register_webinar’ ) || $post->ID == $webinar_shop_page).

Thanks for the great plugin!

Published by 4 Comments

4 Replies

Leave a Reply to pmidev Cancel Reply

Your email address will not be published.