Fixing 2 PHP errors
-
Hi guys, so I have two errors that gets repeated plenty of times in my php errorlog.
First error:
Array to string conversion in woocommerce/zn-woocommerce-init.php on line 96
Line 96 in zn-woocommerce-init.php:
$output .= '<img src="'. woocommerce_placeholder_img_src() .'" alt="Placeholder" width="' . $placeholder_width . '" height="' . $placeholder_height . '" />';Second error:
The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
__construct()
instead. in wp-includes/functions.php on line 3619
Line 3585 to 3630 in functions.php:
/** * Marks a constructor as deprecated and informs when it has been used. * * Similar to _deprecated_function(), but with different strings. Used to * remove PHP4 style constructors. * * The current behavior is to trigger a user error if <code>WP_DEBUG</code> is true. * * This function is to be used in every PHP4 style constructor method that is deprecated. * * @since 4.3.0 * @access private * * @param string $class The class containing the deprecated constructor. * @param string $version The version of WordPress that deprecated the function. */ function _deprecated_constructor( $class, $version ) { /** * Fires when a deprecated constructor is called. * * @since 4.3.0 * * @param string $class The class containing the deprecated constructor. * @param string $version The version of WordPress that deprecated the function. */ do_action( 'deprecated_constructor_run', $class, $version ); /** * Filter whether to trigger an error for deprecated functions. * * <code>WP_DEBUG</code> must be true in addition to the filter evaluating to true. * * @since 4.3.0 * * @param bool $trigger Whether to trigger the error for deprecated functions. Default true. */ if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) { if ( function_exists( '__' ) ) { trigger_error( sprintf( __( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ), $class, $version, '<pre>__construct()</pre>' ) ); } else { trigger_error( sprintf( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $class, $version, '<pre>__construct()</pre>' ) ); } } }Anyone able to spot what I shall edit in these lines?
I thank you in advance and hopefully these errors will be easy to squash 🙂
The topic ‘Fixing 2 PHP errors’ is closed to new replies.