Browse Source

fix php 8 warnings (studio thumb, GF date)

- page-studio.php: guard $img_url[0] (empty when a studio post has no thumbnail
  and no featured_image_url meta) + esc_url it. Kills "Undefined array key 0".
- inc/form.php: declare DW_GF_Date::$_args (PHP 8.2 dynamic-property deprecation).
windhamdavid 4 days ago
parent
commit
17738bd8af
2 changed files with 2 additions and 1 deletions
  1. 1 0
      inc/form.php
  2. 1 1
      page-studio.php

+ 1 - 0
inc/form.php

@@ -44,6 +44,7 @@ function form_submit_button ( $button, $form ){
 ==============================================*/
 ==============================================*/
 
 
 class DW_GF_Date {
 class DW_GF_Date {
+    public $_args;
     public function __construct( $args = array() ) {
     public function __construct( $args = array() ) {
         $this->_args = wp_parse_args( $args, array(
         $this->_args = wp_parse_args( $args, array(
             'form_id'         => false,
             'form_id'         => false,

+ 1 - 1
page-studio.php

@@ -265,7 +265,7 @@
               $img_url = get_post_meta( get_the_ID(), 'featured_image_url');
               $img_url = get_post_meta( get_the_ID(), 'featured_image_url');
             }
             }
           ?>
           ?>
-					<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( '%s', 'daw' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><img class="studio-thumb" src="<?php echo $img_url[0];?>" width="100%" alt="<?php the_title(); ?>"/></a>
+					<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( '%s', 'daw' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><img class="studio-thumb" src="<?php echo esc_url( $img_url[0] ?? '' );?>" width="100%" alt="<?php the_title(); ?>"/></a>
 				</div>
 				</div>
 				<article class="studio">
 				<article class="studio">
 					<div class="entry-content">
 					<div class="entry-content">