From 0f9e815e7284f4328b66ebe4f7f3e6a1bc9db6f8 Mon Sep 17 00:00:00 2001 From: Pedro Matias Date: Fri, 8 Mar 2024 13:09:31 +0000 Subject: [PATCH] Fixed an error -> Deprecated: parse_str(): Passing null to parameter #1 () of type string is deprecated in/Users/pedro.matias/Local Sites/sol/app/public/wp-content/plugins/responsive-youtube-vimeo-popup/inc/class-wp-video-popup-parser.phpon line158 --- inc/class-wp-video-popup-parser.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/inc/class-wp-video-popup-parser.php b/inc/class-wp-video-popup-parser.php index cd262e2..f7e510d 100644 --- a/inc/class-wp-video-popup-parser.php +++ b/inc/class-wp-video-popup-parser.php @@ -155,7 +155,18 @@ public static function get_vimeo_embed_url( $vimeo_video_id, $autoplay = 1 ) { */ private static function parse_url_for_params( $url, $target_params ) { - parse_str( wp_parse_url( $url, PHP_URL_QUERY ), $my_array_of_params ); + if (!empty($url)) { + $query_string = wp_parse_url($url, PHP_URL_QUERY); + if (!empty($query_string)) { // Check for empty query string + parse_str($query_string, $my_array_of_params); + } else { + // Handle empty query string (e.g., return null) + return null; + } + } else { + // Handle the case where $url is null (e.g., log an error message) + log_message('error', "Invalid URL parameter"); + } foreach ( $target_params as $target ) { if ( array_key_exists( $target, $my_array_of_params ) ) {