OiO.lk Blog PHP How can I fix 'Trying to access array offset on value of type bool in' in my PHP code at wp?
PHP

How can I fix 'Trying to access array offset on value of type bool in' in my PHP code at wp?


Notice: Trying to access array offset on value of type bool in

/**
 * Get the image size as array from its meta data.
 *
 * Used for responsive images.
 *
 * @since 4.4.0
 * @access private
 *
 * @param string $size_name  Image size. Accepts any registered image size name.
 * @param array  $image_meta The image meta data.
 * @return array|false {
 *     Array of width and height or false if the size isn't present in the meta data.
 *
 *     @type int $0 Image width.
 *     @type int $1 Image height.
 * }
 */

function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
    if ( 'full' === $size_name ) {
        return array(
            absint( $image_meta['width'] ),
            absint( $image_meta['height'] ),
        );
    } elseif ( ! empty( $image_meta['sizes'][ $size_name ] ) ) {
        return array(
            absint( $image_meta['sizes'][ $size_name ]['width'] ),
            absint( $image_meta['sizes'][ $size_name ]['height'] ),
        );
    }

The error is saying this line is incorrect:

absint( $image_meta[‘width’] ),

This error just came for the first time and I realy need to fix it but I don’t know what it is saying and how to solve. Would anyone can help me out? How should I do?

I try wp about the plugin update. but it still can’t work.



You need to sign in to view this answers

Exit mobile version