Bug #53862 » fu_idna.v3.diff

Michiel Roos, 2013-11-22 12:05

View differences:

typo3_src/typo3/sysext/core/Classes/Utility/GeneralUtility.php (revision )
1302 1302
	 * @return boolean Whether the given URL is valid
1303 1303
	 */
1304 1304
	static public function isValidUrl($url) {
1305
		$parsedUrl = parse_url($url);
1305 1306
		require_once PATH_typo3 . 'contrib/idna/idna_convert.class.php';
1306 1307
		$IDN = new \idna_convert(array('idn_version' => 2008));
1307
		return filter_var($IDN->encode($url), FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) !== FALSE;
1308
		$parsedUrl['host'] = $IDN->encode($parsedUrl['host']);
1309
		$url = HttpUtility::buildUrl($parsedUrl);
1310
		return filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED) !== FALSE;
1308 1311
	}
1309 1312

  
1310 1313
	/*************************
(4-4/13)