Title: PHP 7.2 Warning : Logic Bug
Last modified: November 8, 2018

---

# PHP 7.2 Warning : Logic Bug

 *  [techsurgeons](https://wordpress.org/support/users/techsurgeons/)
 * (@techsurgeons)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/php-7-2-warning-logic-bug/)
 * Howdy, I’m seeing lots of these errors. You’re doing a sizeof on a variable before
   you do the check to see if the variable is empty. Fixing it was trivial – I just
   moved the errant two lines below your check of the variable being empty. See 
   below.
 * [Wed Nov 07 03:11:58.525413 2018] [proxy_fcgi:error] [pid 10274:tid 140219131094
   
   784] [client ??.??.??.??:35986] AH01071: Got error ‘PHP message: PHP Warning:
   sizeof(): Parameter must be an array or an object that implements Countable in/
   home/www/<domasinname>/htdocs/wp-content/plugins/wc-shortcodes/pub lic/class-
   register.php on line 1831\n’
 * **
    Fixed code:
 * if ( empty( $share_buttons ) || ! is_array( $share_buttons ) )
    return ”; $size
   = sizeof( $share_buttons ); $format = get_option( WC_SHORTCODES_PREFIX . ‘share_buttons_format’,‘
   image’ );

The topic ‘PHP 7.2 Warning : Logic Bug’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wc-shortcodes_ffffff.svg)
 * [Shortcodes by Angie Makes](https://wordpress.org/plugins/wc-shortcodes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wc-shortcodes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wc-shortcodes/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-shortcodes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-shortcodes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-shortcodes/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [techsurgeons](https://wordpress.org/support/users/techsurgeons/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/php-7-2-warning-logic-bug/)
 * Status: not resolved