src/Controller/Component/CommonComponent.php
public function getSafeRedirectUrl($default, $data = null, $key = 'redirect') {
		$redirectUrl = $data ?: ($this->Controller->getRequest()->getData($key) ?: $this->Controller->getRequest()->getQuery($key));
		if ($redirectUrl && (mb_substr($redirectUrl, 0, 1) !== '/' || mb_substr($redirectUrl, 0, 2) === '//')) {
			$redirectUrl = null;
		}

		return $redirectUrl ?: $default;
	}
public function getSafeRedirectUrl($default, $data = null, $key = 'redirect') {
		$redirectUrl = $data ?: ($this->Controller->getRequest()->getData($key) ?: $this->Controller->getRequest()->getQuery($key));
		if ($redirectUrl && (mb_substr($redirectUrl, 0, 1) !== '/' || mb_substr($redirectUrl, 0, 2) === '//')) {
			$redirectUrl = null;
		}

		return $redirectUrl ?: $default;
	}
public function getSafeRedirectUrl ( $ default , $ data = null , $ key = 'redirect' ) { $ redirectUrl = $ data ? : ( $ this -> Controller -> getRequest ( ) -> getData ( $ key ) ? : $ this -> Controller -> getRequest ( ) -> getQuery ( $ key ) ) ; if ( $ redirectUrl && ( mb_substr ( $ redirectUrl , 0 , 1 ) !== '/' || mb_substr ( $ redirectUrl , 0 , 2 ) === '//' ) ) { $ redirectUrl = null ; } return $ redirectUrl ? : $ default ; }
Returns internal redirect only, otherwise falls back to default.

Lookup order:
- POST data
- query string
- provided default

@param string|array $default
@param string|array|null $data
@param string $key

@return string|array
Returns internal redirect only otherwise falls back to default .