‪TYPO3CMS  ‪main
legacy-backend.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
16 // Legacy wrapper for typo3/index.php
17 // @deprecated will be removed in TYPO3 v14, /index.php entrypoint should be used directly
18 
19 // defer deprecation log message
20 ‪$_SERVER['TYPO3_DEPRECATED_ENTRYPOINT'] = 1;
21 
22 array_map(
23  static function (string $var): void {
24  $setenv = static function (string $name, string $value = null): void {
25  // If PHP is running as an Apache module and an existing
26  // Apache environment variable exists, overwrite it
27  if (function_exists('apache_getenv') && function_exists('apache_setenv') && apache_getenv($name)) {
28  apache_setenv($name, $value);
29  }
30 
31  if (function_exists('putenv')) {
32  putenv("$name=$value");
33  }
34 
35  $_ENV[$name] = $value;
36  };
37 
38  if (isset(‪$_SERVER[$var])) {
39  ‪$_SERVER[$var] = str_replace('/typo3/index.php', '/index.php', ‪$_SERVER[$var]);
40  }
41  if (isset($_ENV[$var])) {
42  $setenv($var, str_replace('/typo3/index.php', '/index.php', $_ENV[$var]));
43  }
44  },
45  ['SCRIPT_NAME', 'SCRIPT_FILENAME', 'SCRIPT_URI', 'SCRIPT_URL', 'PHP_SELF'],
46 );
47 
48 require '../index.php';
‪$_SERVER
‪$_SERVER['TYPO3_DEPRECATED_ENTRYPOINT']
Definition: legacy-backend.php:20