mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 03:22:39 +00:00
Correcting env('HTTP_BASE') ensuring that when used with no subdomain (http://example.com) it does not return '.com' as the HTTP_BASE
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7679 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
badfb42c6a
commit
2cb2ca554c
2 changed files with 70 additions and 2 deletions
|
@ -402,7 +402,11 @@ if (!function_exists('array_combine')) {
|
|||
return (PHP_SAPI == 'cgi');
|
||||
break;
|
||||
case 'HTTP_BASE':
|
||||
return preg_replace ('/^([^.])*/i', null, env('HTTP_HOST'));
|
||||
$host = env('HTTP_HOST');
|
||||
if (substr_count($host, '.') != 1) {
|
||||
return preg_replace ('/^([^.])*/i', null, env('HTTP_HOST'));
|
||||
}
|
||||
return '.' . $host;
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
|
@ -918,4 +922,4 @@ if (!function_exists('file_put_contents')) {
|
|||
}
|
||||
return $val2;
|
||||
}
|
||||
?>
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue