diff --git a/appendices/reserved.xml b/appendices/reserved.xml index 418308d0e0..5962f4fea1 100755 --- a/appendices/reserved.xml +++ b/appendices/reserved.xml @@ -1,5 +1,5 @@ - + List of Reserved Words @@ -216,6 +216,16 @@ Predefined Variables + + + Since PHP 4.1.0, the preferred method for retrieving + external variables is + with the superglobals mentioned below. Before this time, people relied + on either register_globals + or the long predefined PHP arrays ($HTTP_*_VARS). + + &avail.register-long-arrays; + Server variables: <varname>$_SERVER</varname> diff --git a/chapters/config.xml b/chapters/config.xml index 7600974246..45ea245a85 100644 --- a/chapters/config.xml +++ b/chapters/config.xml @@ -1,5 +1,5 @@ - + Configuration @@ -568,6 +568,11 @@ php_admin_value open_basedir none "On" PHP_INI_PERDIR|PHP_INI_SYSTEM + + register_long_arrays + "On" + PHP_INI_PERDIR|PHP_INI_SYSTEM + post_max_size "8M" @@ -747,6 +752,28 @@ php_admin_value open_basedir none + + + + register_long_arrays + boolean + + + + Tells PHP whether or not to register the deprecated long + $HTTP_*_VARS type + predefined + variables. When On (default), long predefined PHP + variables like $HTTP_GET_VARS will be defined. + If you're not using them, it's recommended to turn them off, + for performance reasons. Instead, use the superglobal arrays, + like $_GET. + + + This directive became available in PHP 5.0.0. + + + diff --git a/chapters/tutorial.xml b/chapters/tutorial.xml index efee5fdc25..0c68e75201 100644 --- a/chapters/tutorial.xml +++ b/chapters/tutorial.xml @@ -1,5 +1,5 @@ - + A simple tutorial @@ -452,6 +452,8 @@ You are 22 years old. $_REQUEST, and $_SESSION. The older $HTTP_*_VARS arrays, such as $HTTP_POST_VARS, still exist and have since PHP 3. + + &avail.register-long-arrays; diff --git a/language-snippets.ent b/language-snippets.ent index e04e06c192..0f9d1544cd 100644 --- a/language-snippets.ent +++ b/language-snippets.ent @@ -77,6 +77,12 @@ directive but instead use other means, such as the &link.superglobals;. etc. have been available. For more information, read the manual section on &link.superglobals;'> +predefined variable +arrays may be disabled with the +register_long_arrays +directive.'> + directive note: magic_quotes_gpc The PHP directive magic_quotes_gpc defaults to on. It essentially diff --git a/language/variables.xml b/language/variables.xml index 1a6721d0aa..fb3452a56f 100644 --- a/language/variables.xml +++ b/language/variables.xml @@ -1,5 +1,5 @@ - + Variables @@ -167,6 +167,8 @@ $bar = &test(); // Invalid. Reserved Predefined Variables. Also, you'll notice how the older predefined variables ($HTTP_*_VARS) still exist. + + &avail.register-long-arrays; @@ -780,7 +782,8 @@ echo "$a $hello"; import_request_variables('p', 'p_'); print $p_username; -// Available since PHP 3. +// Available since PHP 3. As of PHP 5.0.0, these long predefined +// variables can be disabled with the register_long_arrays directive. print $HTTP_POST_VARS['username'];