Title: Empty variables causing strict php errors
Last modified: August 21, 2016

---

# Empty variables causing strict php errors

 *  [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * (@danieliser)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/empty-variables-causing-strict-php-errors-1/)
 * Not sure if this is the write answer as i didnt really look at how this function
   was being used just at fixing the error but something like this should work
 *     ```
       public static function fromString( $string ) {
       		$url = new WordPressHTTPS_Url;
       		@preg_match_all('/((http|https):\/\/[^\'"]+)[\'"\)]?/i', $string, $url_parts);
       		if ( isset($url_parts[1][0]) ) {
       			if ( $url_parts = parse_url( $url_parts[1][0] ) ) {
       				$url->setScheme(@ !empty($url_parts['scheme']) ? $url_parts['scheme'] : NULL);
       				$url->setUser(@ !empty($url_parts['user']) ? $url_parts['user'] : NULL);
       				$url->setPass(@ !empty($url_parts['pass']) ? $url_parts['pass'] : NULL);
       				$url->setHost(@ !empty($url_parts['host']) ? $url_parts['host'] : NULL);
       				$url->setPort(@ !empty($url_parts['port']) ? $url_parts['port'] : NULL);
       				$url->setPath(@ !empty($url_parts['path']) ? $url_parts['path'] : NULL);
       				$url->setQuery(@ !empty($url_parts['query']) ? $url_parts['query'] : NULL);
       				$url->setFragment(@ !empty($url_parts['fragment']) ? $url_parts['fragment'] : NULL);
       				return $url;
       			}
       		} else {
       			 return false;
       		}
       		return $url;
       	}
       ```
   
 * That function is in lib\WordPressHTTPS\Url.php
 * Fixes the Undefined index: errors
 * [http://wordpress.org/plugins/wordpress-https/](http://wordpress.org/plugins/wordpress-https/)

The topic ‘Empty variables causing strict php errors’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-https_bec2c9.svg)
 * [WordPress HTTPS (SSL)](https://wordpress.org/plugins/wordpress-https/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-https/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-https/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-https/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-https/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-https/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Daniel Iser](https://wordpress.org/support/users/danieliser/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/empty-variables-causing-strict-php-errors-1/)
 * Status: not resolved