VIP-Grinders.com
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Gallery Plugin for WordPress - Envira Photo Gallery] php warningHi,
I still get the array key warnings in your release 1.8.6.2
Warning: Undefined array key "link" in /xxx/wp-content/plugins/envira-gallery-lite/includes/global/shortcode.php on line 1545 Warning: Undefined array key "title" in /xxx/wp-content/plugins/envira-gallery-lite/includes/global/shortcode.php on line 436 Warning: Undefined array key "alt" in /xxx/wp-content/plugins/envira-gallery-lite/includes/global/shortcode.php on line 510 Warning: Undefined array key "title" in /xxx/wp-content/plugins/envira-gallery-lite/includes/global/shortcode.php on line 510
My fix for these warnings looks like this, by using a null coalescing operator (??) to the array access, e.g. here shortcode.php on line 510:
$output_item = '<img id="envira-gallery-image-' . sanitize_html_class( $id ) . '" class="envira-gallery-image envira-gallery-image-' . $i . $gallery_theme . ' ' . $envira_lazy_load . '" data-envira-index="' . $i . '" src="' . esc_url( $output_src ) . '"' . ( $this->get_config( 'dimensions', $data ) ? ' width="' . $this->get_config( 'crop_width', $data ) . '" height="' . $this->get_config( 'crop_height', $data ) . '"' : '' ) . ' data-envira-src="' . esc_url( $output_src ) . '" data-envira-gallery-id="' . $data['id'] . '" data-envira-item-id="' . $id . '" data-envira-caption="' . $title . '" alt="' . esc_attr( $item['alt'] ?? '' ) . '" title="' . wp_strip_all_tags( htmlspecialchars( $item['title'] ?? '' ) ) . '" ' . apply_filters( 'envira_gallery_output_image_attr', '', $id, $item, $data, $i ) . ' itemprop="thumbnailUrl" data-envira-srcset="' . esc_url( $output_src ) . ' 400w,' . esc_url( $output_src ) . ' 2x" data-envira-width="' . $output_width . '" data-envira-height="' . $output_height . '" srcset="' . ( ( $envira_lazy_load ) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' : esc_url( $image_src_retina ) . ' 2x' ) . '" data-safe-src="' . ( ( $envira_lazy_load ) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' : esc_url( $output_src ) ) . '" />';
Hi,
I just switched to php8.1 and getting these warnings:
Warning: Undefined array key "link" in /var/www/vhosts/vip-grinders.com/httpdocs/wp-content/plugins/envira-gallery-lite/includes/global/shortcode.php on line 1528 Warning: Undefined array key "title" in /var/www/vhosts/vip-grinders.com/httpdocs/wp-content/plugins/envira-gallery-lite/includes/global/shortcode.php on line 405 Warning: Undefined array key "alt" in /var/www/vhosts/vip-grinders.com/httpdocs/wp-content/plugins/envira-gallery-lite/includes/global/shortcode.php on line 482 Warning: Undefined array key "title" in /var/www/vhosts/vip-grinders.com/httpdocs/wp-content/plugins/envira-gallery-lite/includes/global/shortcode.php on line 482
Quick and dirty solution:
$item[‘link’] ?? ”
- This reply was modified 2 years, 5 months ago by VIP-Grinders.com.
- This reply was modified 2 years, 5 months ago by VIP-Grinders.com.
Viewing 2 replies - 1 through 2 (of 2 total)