php.ini settings
================
-All Horde code should work with `register_globals`_ disabled. This means
-using ``$_COOKIE``, ``$_SESSION``, ``$_SERVER`` and ``$_ENV`` to access all
-cookie, session, server and environment data, respectively. By the same token,
-all Horde code should also work with `register_globals`_ enabled. Since
-applications can be expected to store data in $_SESSION['application'] it is
-therefor important that applications NOT register $GLOBALS in their own
-application name. For instance the application "foo" may create and use
-$_SESSION['foo'] but not $GLOBALS['foo']. Failing this rule may cause problems
-on PHP installations on which `register_globals`_ is enabled.
+Horde code MUST NOT use global variables set by EGPCS (Environment, GET, POST,
+Cookie, Server) data. Instead, the magic variables ``$_ENV``, ``$_GET``,
+``$_POST``, $_COOKIE``, and ``$_SERVER`` must be used instead.
To retrieve posted data (in the global ``$_GET`` and ``$_POST`` variables),
you should normally use `Horde_Util::getFormData()`_ which will automatically
'./' in front of a filename when you are including a file in the same
directory.
-.. _register_globals: http://www.php.net/manual/en/security.registerglobals.php
.. _magic_quotes_gpc: http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc
.. _error_reporting: http://www.php.net/manual/en/ref.errorfunc.php#ini.error-reporting
.. _Horde_Util::getFormData(): http://dev.horde.org/api/framework/Horde_Util/Horde_Util.html#methodgetFormData
ini_set('zend.ze1_compatibility_mode', 0);
ini_set('allow_url_include', 0);
-/* Unset all variables populated through register_globals. */
+/* Exit immediately if register_globals is active. */
if (ini_get('register_globals')) {
- foreach (array($_GET, $_POST, $_COOKIE, $_ENV, $_SERVER) as $var) {
- foreach (array_keys($var) as $key) {
- unset($$key);
- }
- }
+ exit('Register globals is enabled. Exiting.');
}
if (!defined('HORDE_BASE')) {
'setting' => 'value',
'error' => 'If PHP\'s internal memory limit is not set high enough Horde will not be able to handle large data items. You should set the value of memory_limit in php.ini to a sufficiently high value - at least 64M is recommended.'
),
+ 'register_globals' => array(
+ 'setting' => false,
+ 'error' => 'Register globals has been deprecated in PHP 5. Horde will fatally exit if it is set. Turn it off.'
+ ),
'safe_mode' => array(
'setting' => false,
'error' => 'If safe_mode is enabled, Horde cannot set enviroment variables, which means Horde will be unable to translate the user interface into different languages.'