From 5cf2359ebe6b828a14884614771e550e647a823a Mon Sep 17 00:00:00 2001 From: "mohammed.razzaq" Date: Fri, 26 Jan 2024 14:08:52 +0530 Subject: [PATCH 1/2] Fix: Undefined array key sub_type --- includes/admin/api/class-bc-admin-media-api.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/admin/api/class-bc-admin-media-api.php b/includes/admin/api/class-bc-admin-media-api.php index db2b7886..ad42d229 100644 --- a/includes/admin/api/class-bc-admin-media-api.php +++ b/includes/admin/api/class-bc-admin-media-api.php @@ -249,8 +249,9 @@ public function bc_ajax_update_video_or_playlist() { } elseif ( 'videos' === $_POST['type'] ) { $type_msg = 'video'; - if ( 'variant' === $_POST['sub_type'] ) { - $status = $this->videos->update_bc_video( $updated_data, sanitize_text_field( $_POST['sub_type'] ) ); + $sub_type = $_POST['sub_type'] ?? ''; + if ( 'variant' === $sub_type ) { + $status = $this->videos->update_bc_video( $updated_data, sanitize_text_field( $sub_type ) ); } else { $status = $this->videos->update_bc_video( $updated_data ); From 638dc70dc19bbd2bf51d83cd1354a972ae1d8c24 Mon Sep 17 00:00:00 2001 From: "mohammed.razzaq" Date: Tue, 30 Jan 2024 16:11:00 +0530 Subject: [PATCH 2/2] Update code for PHP5 compatibility --- includes/admin/api/class-bc-admin-media-api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/api/class-bc-admin-media-api.php b/includes/admin/api/class-bc-admin-media-api.php index ad42d229..6f9fbb42 100644 --- a/includes/admin/api/class-bc-admin-media-api.php +++ b/includes/admin/api/class-bc-admin-media-api.php @@ -249,9 +249,9 @@ public function bc_ajax_update_video_or_playlist() { } elseif ( 'videos' === $_POST['type'] ) { $type_msg = 'video'; - $sub_type = $_POST['sub_type'] ?? ''; + $sub_type = isset( $_POST['sub_type'] ) ? sanitize_text_field( $_POST['sub_type'] ) : ''; if ( 'variant' === $sub_type ) { - $status = $this->videos->update_bc_video( $updated_data, sanitize_text_field( $sub_type ) ); + $status = $this->videos->update_bc_video( $updated_data, $sub_type ); } else { $status = $this->videos->update_bc_video( $updated_data );