Title: Undefined array key
Last modified: April 24, 2025

---

# Undefined array key

 *  Resolved [vespino](https://wordpress.org/support/users/vespino/)
 * (@vespino)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/undefined-array-key-61/)
 * With the latest version of the plugin I’m getting these warnings:
 *     ```
       [24-Apr-2025 05:01:21 UTC] PHP Warning:  Undefined array key "scheme" in /***/public_html/wp-content/plugins/wpcf7-redirect/vendor/codeinwp/themeisle-sdk/load.php on line 238
       [24-Apr-2025 05:01:21 UTC] PHP Warning:  Undefined array key "host" in /***/public_html/wp-content/plugins/wpcf7-redirect/vendor/codeinwp/themeisle-sdk/load.php on line 238
       [24-Apr-2025 05:01:23 UTC] PHP Warning:  Undefined array key "scheme" in /***/public_html/wp-content/plugins/wpcf7-redirect/vendor/codeinwp/themeisle-sdk/load.php on line 238
       ```
   
    -  This topic was modified 1 year, 1 month ago by [vespino](https://wordpress.org/support/users/vespino/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [rodicaelena](https://wordpress.org/support/users/rodicaelena/)
 * (@rodicaelena)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/undefined-array-key-61/#post-18433291)
 * Hi [@vespino](https://wordpress.org/support/users/vespino/),
 * Thank you very much for sharing this. We’ll fix it in the next release.
 * Kind regards,
 * Rodica
 *  [Saskia Teichmann](https://wordpress.org/support/users/jyria/)
 * (@jyria)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/undefined-array-key-61/#post-18434441)
 * **Fix for PHP Warnings in ThemeIsle SDK (load.php)**
 * Hi there,
 * I also noticed these PHP warnings in the debug log related to the ThemeIsle SDK
   used by the wpcf7-redirect plugin. The warnings occur in the `tsdk_translate_link()`
   function when trying to access undefined array keys ‘scheme’ and ‘host’.
 * Warnings:
 *     ```wp-block-code
       PHP Warning: Undefined array key "scheme" in [...]/themeisle-sdk/load.php on line 238
       PHP Warning: Undefined array key "host" in [...]/themeisle-sdk/load.php on line 238
       ```
   
 * I’ve created a fix that adds proper validation checks before accessing the URL
   components. Here’s the modified version of the function, which can be found in
   the file /wp-content/plugins/wpcf7-redirect/vendor/codeinwp/themeisle-sdk/load.
   php at line 205ff:
 *     ```wp-block-code
       	/**	 * Function to translate a link based on the current language.	 *	 * @param string                          $url URL to translate.	 * @param string{'path'|'query'|'domain'} $type Type of localization. Supports path, query and domain.	 * @param array                           $available_languages Available language to choose from.	 *	 * @return string	 */	function tsdk_translate_link(		$url, $type = 'path', $available_languages = [			'de_DE'        => 'de',			'de_DE_formal' => 'de',		]	) {		$language = get_user_locale();		if ( ! isset( $available_languages[ $language ] ) ) {			return $url;		}		$code = $available_languages[ $language ];		// We asume that false is based on query and add the code via query arg.		if ( $type === 'query' ) {			return add_query_arg( 'lang', $code, $url );		}		$parsed_url = wp_parse_url($url);		// Sicherheitsprüfung für ungültige URLs		if (!is_array($parsed_url) || empty($parsed_url)) {			return $url;		}		// we replace the domain here based on the localized one.		if ( $type === 'domain' ) {			if (!isset($parsed_url['scheme']) || !isset($parsed_url['path'])) {				return $url;			}			return $parsed_url['scheme'] . '://' . $code . 				( isset( $parsed_url['path'] ) ? $parsed_url['path'] : '' ) . 				( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' ) . 				( isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : '' );		}		// default is the path based approach.		$new_path = isset( $parsed_url['path'] ) ? "/$code" . $parsed_url['path'] : "/$code";		// Stelle sicher, dass alle notwendigen URL-Komponenten vorhanden sind		if (!isset($parsed_url['scheme']) || !isset($parsed_url['host'])) {			return $url;		}		return $parsed_url['scheme'] . '://' . $parsed_url['host'] . $new_path . 			( isset( $parsed_url['query'] ) ? '?' . $parsed_url['query'] : '' ) . 			( isset( $parsed_url['fragment'] ) ? '#' . $parsed_url['fragment'] : '' );	}
       ```
   
 * The changes include:
    1. Validation of the parsed URL array
    2. Specific checks for the ‘domain’ type approach
    3. Validation of required URL components (scheme and host)
    4. Fallback to original URL if required components are missing
 * This fix maintains all functionality while eliminating the PHP warnings. Feel
   free to incorporate these changes in a future update.
 * Best regards
 *  Plugin Support [Kush](https://wordpress.org/support/users/kushnamdev/)
 * (@kushnamdev)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/undefined-array-key-61/#post-18438371)
 * Thank you for sharing this with us. Our team will take a look at this. Have a
   great day!
 *  Plugin Support [rodicaelena](https://wordpress.org/support/users/rodicaelena/)
 * (@rodicaelena)
 * [1 year, 1 month ago](https://wordpress.org/support/topic/undefined-array-key-61/#post-18441513)
 * Hi there,
 * The latest update should fix this. Can you please let us know if you are still
   experiencing issues or everything is ok?
 * Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Undefined array key’ is closed to new replies.

 * ![](https://ps.w.org/wpcf7-redirect/assets/icon-256x256.gif?rev=3416723)
 * [Redirection for Contact Form 7](https://wordpress.org/plugins/wpcf7-redirect/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpcf7-redirect/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpcf7-redirect/)
 * [Active Topics](https://wordpress.org/support/plugin/wpcf7-redirect/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpcf7-redirect/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpcf7-redirect/reviews/)

 * 4 replies
 * 4 participants
 * Last reply from: [rodicaelena](https://wordpress.org/support/users/rodicaelena/)
 * Last activity: [1 year, 1 month ago](https://wordpress.org/support/topic/undefined-array-key-61/#post-18441513)
 * Status: resolved