Woocommerce Error Being Generated
-
Hi there I am not sure who to contact regarding the following: [29-May-2023 02:03:43 UTC] PHP Warning: Trying to access array offset on value of type bool in /home/zedtdnbp/public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1612 Below is the code from that line: return '<div data-thumb="' . esc_url( $thumbnail_src[0] ) . '" data-thumb-alt="' . esc_attr( $alt_text ) . '" class="woocommerce-product-gallery__image"><a href="' . esc_url( $full_src[0] ) . '">' . $image . '</a></div>'; When I look at the full code it also does look collation related which would be odd since utf8mb4 and is even mentioned in their documentation: * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. * As of WP 4.2, however, they moved to utf8mb4, which uses 4 bytes per character. This means that an index which * used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters. Alternatively it could just be some custom CSS or something as simple as a missing thumbnail. Here’s a snippet from with the full function definition: 1582 function wc_get_gallery_image_html( $attachment_id, $main_image = false ) { 1583 $flexslider = (bool) apply_filters( 'woocommerce_single_product_flexslider_enabled', get_theme_support( 'wc-product-gallery-slider' ) ); 1584 $gallery_thumbnail = wc_get_image_size( 'gallery_thumbnail' ); 1585 $thumbnail_size = apply_filters( 'woocommerce_gallery_thumbnail_size', array( $gallery_thumbnail['width'], $gallery_thumbnail['height'] ) ); 1586 $image_size = apply_filters( 'woocommerce_gallery_image_size', $flexslider || $main_image ? 'woocommerce_single' : $thumbnail_size ); 1587 $full_size = apply_filters( 'woocommerce_gallery_full_size', apply_filters( 'woocommerce_product_thumbnails_large_size', 'full' ) ); 1588 $thumbnail_src = wp_get_attachment_image_src( $attachment_id, $thumbnail_size ); 1589 $full_src = wp_get_attachment_image_src( $attachment_id, $full_size ); 1590 $alt_text = trim( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ); 1591 $image = wp_get_attachment_image( 1592 $attachment_id, 1593 $image_size, 1594 false, 1595 apply_filters( 1596 'woocommerce_gallery_image_html_attachment_image_params', 1597 array( 1598 'title' => _wp_specialchars( get_post_field( 'post_title', $attachment_id ), ENT_QUOTES, 'UTF-8', true ), 1599 'data-caption' => _wp_specialchars( get_post_field( 'post_excerpt', $attachment_id ), ENT_QUOTES, 'UTF-8', true ), 1600 'data-src' => esc_url( $full_src[0] ), 1601 'data-large_image' => esc_url( $full_src[0] ), 1602 'data-large_image_width' => esc_attr( $full_src[1] ), 1603 'data-large_image_height' => esc_attr( $full_src[2] ), 1604 'class' => esc_attr( $main_image ? 'wp-post-image' : '' ), 1605 ), 1606 $attachment_id, 1607 $image_size, 1608 $main_image 1609 ) 1610 ); 1611 1612 return '<div data-thumb="' . esc_url( $thumbnail_src[0] ) . '" data-thumb-alt="' . esc_attr( $alt_text ) . '" class="woocommerce-product-gallery__image"><a href="' . esc_url 1612 ( $full_src[0] ) . '">' . $image . '</a></div>';
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Woocommerce Error Being Generated’ is closed to new replies.