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.