[PATCH] Restructuring built-in variables

From: Date: Sat, 12 Apr 2008 20:23:54 +0000
Subject: [PATCH] Restructuring built-in variables
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969378779@lists.php.net to get a copy of this message
Hi all Now that the extension/class restructuring are online I think we should start restructuring other stuff ;) for instance the timezone appendix should probably be apart of the datetime extension.. Anyway. The built-in variables have been bothering me for quite some time, hard to find, crazy hard to navigate and duplicated content. I've refactored those built-in variables into its own reference, with each variable as its own refentry. 90% of this is cut&paste, almost no new content. What do you guys think? If this looks OK to you all I'd like to do something similar with the stream context options, classes and exceptions. -Hannes

Index: manual.xml.in =================================================================== RCS file: /repository/phpdoc/manual.xml.in,v retrieving revision 1.249 diff -u -p -r1.249 manual.xml.in --- manual.xml.in 11 Apr 2008 22:27:43 -0000 1.249 +++ manual.xml.in 12 Apr 2008 19:59:10 -0000 @@ -97,6 +97,7 @@ &language.namespaces; &language.exceptions; &language.references; + &language.predefined.variables; </book> <book xml:id="security"> Index: en/language-snippets.ent =================================================================== RCS file: /repository/phpdoc/en/language-snippets.ent,v retrieving revision 1.219 diff -u -p -r1.219 language-snippets.ent --- en/language-snippets.ent 25 Mar 2008 03:21:33 -0000 1.219 +++ en/language-snippets.ent 12 Apr 2008 19:59:39 -0000 @@ -65,6 +65,12 @@ off</emphasis>, and it was completely re discourages developers from relying on this directive, and encouragees the use of other means, such as the &link.superglobals;.</para></note>'> +<!ENTITY note.is-superglobal "<note><para>This is a 'superglobal', or +automatic global, variable. This simply means that it is available in +all scopes throughout a script. You don't need to do a +<command>global $variable;</command> to access it within functions or methods. +</para></note>"> + <!ENTITY note.superglobals '<note><title>Superglobals: availability note </title><para>Superglobal arrays such as <varname>$_GET</varname>, <varname>$_POST</varname>, and <varname>$_SERVER</varname>, etc. are available Index: en/appendices/reserved.xml =================================================================== RCS file: /repository/phpdoc/en/appendices/reserved.xml,v retrieving revision 1.72 diff -u -p -r1.72 reserved.xml --- en/appendices/reserved.xml 19 Feb 2008 21:45:29 -0000 1.72 +++ en/appendices/reserved.xml 12 Apr 2008 19:59:10 -0000 @@ -284,861 +284,6 @@ </table> </sect1> - <sect1 xml:id="reserved.variables"> - <title>Predefined Variables</title> - - <para> - Since PHP 4.1.0, the preferred method for retrieving - <link linkend="language.variables.external">external variables</link> is - with the superglobals mentioned below. Before this time, people relied - on either <link linkend="ini.register-globals">register_globals</link> - or the long predefined PHP arrays (<varname>$HTTP_*_VARS</varname>). - - &avail.register-long-arrays; - </para> - - <sect2 xml:id="reserved.variables.server"> - <title>Server variables: <varname>$_SERVER</varname></title> - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_SERVER_VARS</varname>. - </simpara> - </note> - - <simpara> - <varname>$_SERVER</varname> is an array containing information - such as headers, paths, and script locations. The entries in this - array are created by the web server. There is no guarantee that - every web server will provide any of these; servers may omit some, - or provide others not listed here. That said, a large number of - these variables are accounted for in the <link - xlink:href="&url.cgispec;">CGI 1.1 specification</link>, so you should - be able to expect those. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_SERVER;</command> to access it within functions or methods, as - you do with <varname>$HTTP_SERVER_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_SERVER_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_SERVER_VARS</varname> and <varname>$_SERVER</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_SERVER</varname> and <varname>$HTTP_SERVER_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - - <simpara> - You may or may not find any of the following elements in - $_SERVER. Note that few, if any, of these will be available (or - indeed have any meaning) if running PHP on the command line. - </simpara> - - <para> - <variablelist> - <varlistentry> - <term>'<varname>PHP_SELF</varname>'</term> - <listitem> - <simpara> - The filename of the currently executing script, relative to - the document root. For instance, - <varname>$_SERVER['PHP_SELF']</varname> in a script at the - address <filename>http://example.com/test.php/foo.bar</filename> - would be <filename>/test.php/foo.bar</filename>. - The <link linkend="language.constants.predefined">__FILE__</link> - constant contains the full path and filename of the current (i.e. - included) file. - </simpara> - <simpara> - If PHP is running as a command-line processor this variable contains - the script name since PHP 4.3.0. Previously it was not available. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>argv</varname>'</term> - <listitem> - <simpara> - Array of arguments passed to the script. When the script is - run on the command line, this gives C-style access to the - command line parameters. When called via the GET method, this - will contain the query string. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>argc</varname>'</term> - <listitem> - <simpara> - Contains the number of command line parameters passed to the - script (if run on the command line). - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>GATEWAY_INTERFACE</varname>'</term> - <listitem> - <simpara> - What revision of the CGI specification the server is using; - i.e. '<literal>CGI/1.1</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_ADDR</varname>'</term> - <listitem> - <simpara> - The IP address of the server under which the current script is - executing. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_NAME</varname>'</term> - <listitem> - <simpara> - The name of the server host under which the current script is - executing. If the script is running on a virtual host, this - will be the value defined for that virtual host. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_SOFTWARE</varname>'</term> - <listitem> - <simpara> - Server identification string, given in the headers when - responding to requests. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_PROTOCOL</varname>'</term> - <listitem> - <simpara> - Name and revision of the information protocol via which the - page was requested; i.e. '<literal>HTTP/1.0</literal>'; - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_METHOD</varname>'</term> - <listitem> - <simpara> - Which request method was used to access the page; i.e. '<literal>GET</literal>', - '<literal>HEAD</literal>', '<literal>POST</literal>', '<literal>PUT</literal>'. - </simpara> - <note> - <para> - PHP script is terminated after sending headers (it means after - producing any output without output buffering) if the request method - was <literal>HEAD</literal>. - </para> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_TIME</varname>'</term> - <listitem> - <simpara> - The timestamp of the start of the request. Available since PHP 5.1.0. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>QUERY_STRING</varname>'</term> - <listitem> - <simpara> - The query string, if any, via which the page was accessed. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>DOCUMENT_ROOT</varname>'</term> - <listitem> - <simpara> - The document root directory under which the current script is - executing, as defined in the server's configuration file. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept:</literal> header from the - current request, if there is one. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_CHARSET</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Charset:</literal> header - from the current request, if there is one. Example: - '<literal>iso-8859-1,*,utf-8</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_ENCODING</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Encoding:</literal> header - from the current request, if there is one. Example: '<literal>gzip</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_ACCEPT_LANGUAGE</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Accept-Language:</literal> header - from the current request, if there is one. Example: '<literal>en</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_CONNECTION</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Connection:</literal> header from - the current request, if there is one. Example: '<literal>Keep-Alive</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_HOST</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>Host:</literal> header from the - current request, if there is one. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_REFERER</varname>'</term> - <listitem> - <simpara> - The address of the page (if any) which referred the user - agent to the current page. This is set by the user agent. Not - all user agents will set this, and some provide the ability - to modify <varname>HTTP_REFERER</varname> as a feature. In - short, it cannot really be trusted. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTP_USER_AGENT</varname>'</term> - <listitem> - <simpara> - Contents of the <literal>User-Agent:</literal> header from - the current request, if there is one. This is a string - denoting the user agent being which is accessing the page. A - typical example is: <computeroutput>Mozilla/4.5 [en] (X11; U; - Linux 2.2.9 i586)</computeroutput>. Among other things, you - can use this value with <function>get_browser</function> to - tailor your page's output to the capabilities of the user - agent. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>HTTPS</varname>'</term> - <listitem> - <simpara> - Set to a non-empty value if the script was queried through the HTTPS - protocol. - </simpara> - <simpara> - Note that when using ISAPI with IIS, the value will be - <literal>off</literal> if the request was not made through the HTTPS - protocol. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_ADDR</varname>'</term> - <listitem> - <simpara> - The IP address from which the user is viewing the current - page. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_HOST</varname>'</term> - <listitem> - <simpara> - The Host name from which the user is viewing the current - page. The reverse dns lookup is based off the - <varname>REMOTE_ADDR</varname> of the user. - </simpara> - <note> - <simpara> - Your web server must be configured to create this variable. For - example in Apache you'll need <literal>HostnameLookups On</literal> - inside &httpd.conf; for it to exist. See also - <function>gethostbyaddr</function>. - </simpara> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REMOTE_PORT</varname>'</term> - <listitem> - <simpara> - The port being used on the user's machine to communicate with - the web server. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SCRIPT_FILENAME</varname>'</term> - <listitem> - <para> - The absolute pathname of the currently executing script. - <note> - <para> - If a script is executed with the CLI, as a relative path, - such as <filename>file.php</filename> or - <filename>../file.php</filename>, - <varname>$_SERVER['SCRIPT_FILENAME']</varname> will - contain the relative path specified by the user. - </para> - </note> - </para> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_ADMIN</varname>'</term> - <listitem> - <simpara> - The value given to the SERVER_ADMIN (for Apache) directive in - the web server configuration file. If the script is running - on a virtual host, this will be the value defined for that - virtual host. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_PORT</varname>'</term> - <listitem> - <simpara> - The port on the server machine being used by the web server - for communication. For default setups, this will be '<literal>80</literal>'; - using SSL, for instance, will change this to whatever your - defined secure HTTP port is. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SERVER_SIGNATURE</varname>'</term> - <listitem> - <simpara> - String containing the server version and virtual host name - which are added to server-generated pages, if enabled. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PATH_TRANSLATED</varname>'</term> - <listitem> - <simpara> - Filesystem- (not document root-) based path to the current - script, after the server has done any virtual-to-real - mapping. - </simpara> - <note> - <simpara> - As of PHP 4.3.2, <envar>PATH_TRANSLATED</envar> is no longer set - implicitly under the Apache 2 <acronym>SAPI</acronym> in contrast - to the situation in Apache 1, where it's set to the same value as - the <envar>SCRIPT_FILENAME</envar> server variable when it's not - populated by Apache. This change was made to comply with the - <acronym>CGI</acronym> specification that - <envar>PATH_TRANSLATED</envar> should only exist if - <envar>PATH_INFO</envar> is defined. - </simpara> - <simpara> - Apache 2 users may use <literal>AcceptPathInfo = On</literal> inside - <filename>httpd.conf</filename> to define <envar>PATH_INFO</envar>. - </simpara> - </note> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>SCRIPT_NAME</varname>'</term> - <listitem> - <simpara> - Contains the current script's path. This is useful for pages - which need to point to themselves. - The <link linkend="language.constants.predefined">__FILE__</link> - constant contains the full path and filename of the current (i.e. - included) file. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>REQUEST_URI</varname>'</term> - <listitem> - <simpara> - The URI which was given in order to access this page; for - instance, '<literal>/index.html</literal>'. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_DIGEST</varname>'</term> - <listitem> - <simpara> - When running under Apache as module doing Digest HTTP authentication - this variable is set to the 'Authorization' header sent by the - client (which you should then use to make the appropriate - validation). - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_USER</varname>'</term> - <listitem> - <simpara> - When running under Apache or IIS (ISAPI on PHP 5) as module doing - HTTP authentication this variable is set to the username provided by - the user. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>PHP_AUTH_PW</varname>'</term> - <listitem> - <simpara> - When running under Apache or IIS (ISAPI on PHP 5) as module doing - HTTP authentication this variable is set to the password provided by - the user. - </simpara> - </listitem> - </varlistentry> - - <varlistentry> - <term>'<varname>AUTH_TYPE</varname>'</term> - <listitem> - <simpara> - When running under Apache as module doing HTTP authenticated this - variable is set to the authentication type. - </simpara> - </listitem> - </varlistentry> - - </variablelist> - </para> - - </sect2> - - <sect2 xml:id="reserved.variables.environment"> - <title>Environment variables: <varname>$_ENV</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_ENV_VARS</varname>. - </simpara> - </note> - - <simpara> - These variables are imported into PHP's global namespace from the - environment under which the PHP parser is running. Many are - provided by the shell under which PHP is running and different - systems are likely running different kinds of shells, a - definitive list is impossible. Please see your shell's - documentation for a list of defined environment variables. - </simpara> - - <simpara> - Other environment variables include the CGI variables, placed - there regardless of whether PHP is running as a server module or - CGI processor. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_ENV;</command> to access it within functions or methods, as - you do with <varname>$HTTP_ENV_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_ENV_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_ENV_VARS</varname> and <varname>$_ENV</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_ENV</varname> and <varname>$HTTP_ENV_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.cookies"> - <title>HTTP Cookies: <varname>$_COOKIE</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_COOKIE_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via HTTP cookies. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_COOKIE;</command> to access it within functions or methods, as - you do with <varname>$HTTP_COOKIE_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_COOKIE_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_COOKIE_VARS</varname> and <varname>$_COOKIE</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_COOKIE</varname> and <varname>$HTTP_COOKIE_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.get"> - <title>HTTP GET variables: <varname>$_GET</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_GET_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via the HTTP GET method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_GET;</command> to access it within functions or methods, as - you do with <varname>$HTTP_GET_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_GET_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_GET_VARS</varname> and <varname>$_GET</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_GET</varname> and <varname>$HTTP_GET_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.post"> - <title>HTTP POST variables: <varname>$_POST</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_POST_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array of variables passed to the current script - via the HTTP POST method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_POST;</command> to access it within functions or methods, as - you do with <varname>$HTTP_POST_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_POST_VARS</varname> contains the same initial - information, but is not a superglobal. (Note that - <varname>$HTTP_POST_VARS</varname> and <varname>$_POST</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_POST</varname> and <varname>$HTTP_POST_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.files"> - <title>HTTP File upload variables: <varname>$_FILES</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_POST_FILES</varname>. - </simpara> - </note> - - <simpara> - An associative array of items uploaded to the current script - via the HTTP POST method. Automatically global in any scope. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_FILES;</command> to access it within functions or methods, as - you do with <varname>$HTTP_POST_FILES</varname>. - </simpara> - - <simpara> - <varname>$HTTP_POST_FILES</varname> contains the same - information, but is not a superglobal. (Note that - <varname>$HTTP_POST_FILES</varname> and <varname>$_FILES</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_FILES</varname> and <varname>$HTTP_POST_FILES</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.request"> - <title>Request variables: <varname>$_REQUEST</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. There is no equivalent array in earlier - versions. - </simpara> - </note> - <note> - <simpara> - Prior to PHP 4.3.0, <varname>$_FILES</varname> information was - also included in <varname>$_REQUEST</varname>. - </simpara> - </note> - - <simpara> - An associative array consisting of the contents of - <varname>$_GET</varname>, <varname>$_POST</varname>, - and <varname>$_COOKIE</varname>. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_REQUEST;</command> to access it within functions or methods. - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_REQUEST</varname> array. For related information, see - the security chapter titled <link - linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.session"> - <title>Session variables: <varname>$_SESSION</varname></title> - - <note> - <simpara> - Introduced in 4.1.0. In earlier versions, use - <varname>$HTTP_SESSION_VARS</varname>. - </simpara> - </note> - - <simpara> - An associative array containing session variables available to - the current script. See the <link linkend="ref.session">Session - functions</link> documentation for more information on how this - is used. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $_SESSION;</command> to access it within functions or methods, as - you do with <varname>$HTTP_SESSION_VARS</varname>. - </simpara> - - <simpara> - <varname>$HTTP_SESSION_VARS</varname> contains the same - information, but is not a superglobal. (Note that - <varname>$HTTP_SESSION_VARS</varname> and <varname>$_SESSION</varname> - are different variables and that PHP handles them as such) - </simpara> - - <simpara> - If the <link - linkend="ini.register-globals">register_globals</link> directive - is set, then these variables will also be made available in the - global scope of the script; i.e., separate from the - <varname>$_SESSION</varname> and <varname>$HTTP_SESSION_VARS</varname> - arrays. For related information, see the security chapter titled - <link linkend="security.globals">Using Register - Globals</link>. These individual globals are not superglobals. - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.globals"> - <title>Global variables: <varname>$GLOBALS</varname></title> - - <simpara> - An associative array containing references to all variables which - are currently defined in the global scope of the script. The - variable names are the keys of the array. - </simpara> - - <simpara> - This is a 'superglobal', or automatic global, variable. This - simply means that it is available in all scopes throughout a - script. You don't need to do a <command>global - $GLOBALS;</command> to access it within functions or methods. - </simpara> - - </sect2> - - <sect2 xml:id="reserved.variables.phperrormsg"> - <title>The previous error message: <varname>$php_errormsg</varname></title> - <simpara> - <varname>$php_errormsg</varname> is a variable containing the - text of the last error message generated by PHP. This variable - will only be available within the scope in which the error - occurred, and only if the <link - linkend="ini.track-errors">track_errors</link> configuration - option is turned on (it defaults to off). - </simpara> - </sect2> - - <sect2 xml:id="reserved.variables.httprawpostdata"> - <title>Raw POST data: <varname>$HTTP_RAW_POST_DATA</varname></title> - <para> - <varname>$HTTP_RAW_POST_DATA</varname> contains the raw POST data. - See <link linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link> - </para> - </sect2> - - <sect2 xml:id="reserved.variables.httpresponseheader"> - <title>HTTP response headers: <varname>$http_response_header</varname></title> - <para> - The <varname>$http_response_header</varname> array is similiar to the - <function>get_headers</function> function. When using the - <link linkend="wrappers.http">HTTP wrapper</link> - <varname>$http_response_header</varname> will be populated with the HTTP - response headers. - </para> - </sect2> - - </sect1> <sect1 xml:id="reserved.classes"> <title>Predefined Classes</title> <para> Index: en/language/variables.xml =================================================================== RCS file: /repository/phpdoc/en/language/variables.xml,v retrieving revision 1.99 diff -u -p -r1.99 variables.xml --- en/language/variables.xml 19 Feb 2008 21:45:29 -0000 1.99 +++ en/language/variables.xml 12 Apr 2008 19:59:11 -0000 @@ -233,126 +233,6 @@ $unset_array[3] = "def"; // array() + ar linkend="ini.variables-order">variables_order</link> are not set, their appropriate PHP predefined arrays are also left empty. </para> - - <variablelist xml:id="language.variables.superglobals"> - <title>PHP Superglobals</title> - <varlistentry> - <term><link linkend="reserved.variables.globals">$GLOBALS</link></term> - <listitem> - <simpara> - Contains a reference to every variable which is currently - available within the global scope of the script. The keys of - this array are the names of the global variables. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.server">$_SERVER</link></term> - <listitem> - <simpara> - Variables set by the web server or otherwise directly related - to the execution environment of the current script. Analogous - to the old <varname>$HTTP_SERVER_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.get">$_GET</link></term> - <listitem> - <simpara> - Variables provided to the script via URL query string. Analogous to the - old <varname>$HTTP_GET_VARS</varname> array (which is still - available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.post">$_POST</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP POST. Analogous to the - old <varname>$HTTP_POST_VARS</varname> array (which is still - available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.cookies">$_COOKIE</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP cookies. Analogous to - the old <varname>$HTTP_COOKIE_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.files">$_FILES</link></term> - <listitem> - <simpara> - Variables provided to the script via HTTP post file - uploads. Analogous to the old - <varname>$HTTP_POST_FILES</varname> array (which is still - available, but deprecated). See <link - linkend="features.file-upload.post-method">POST method - uploads</link> for more information. - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.environment">$_ENV</link></term> - <listitem> - <simpara> - Variables provided to the script via the environment. Analogous - to the old <varname>$HTTP_ENV_VARS</varname> array (which is - still available, but deprecated). - </simpara> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.request">$_REQUEST</link></term> - <listitem> - <simpara> - Variables provided to the script via the GET, POST, and COOKIE input - mechanisms, and which therefore cannot be trusted. The presence and - order of variable inclusion in this array is defined according to the - PHP <link linkend="ini.variables-order">variables_order</link> - configuration directive. This array has no direct analogue in versions - of PHP prior to 4.1.0. See also - <function>import_request_variables</function>. - </simpara> - <caution> - <simpara> - Since PHP 4.3.0, FILE information from <varname>$_FILES</varname> does - not exist in <varname>$_REQUEST</varname>. - </simpara> - </caution> - <note> - <simpara> - When running on the <link linkend="features.commandline">command line - </link>, this will <emphasis>not</emphasis> include the - <varname>argv</varname> and <varname>argc</varname> entries; these are - present in the <varname>$_SERVER</varname> array. - </simpara> - </note> - </listitem> - </varlistentry> - <varlistentry> - <term><link linkend="reserved.variables.session">$_SESSION</link></term> - <listitem> - <simpara> - Variables which are currently registered to a script's - session. Analogous to the old - <varname>$HTTP_SESSION_VARS</varname> array (which is still - available, but deprecated). See the <link - linkend="ref.session">Session handling functions</link> section - for more information. - </simpara> - </listitem> - </varlistentry> - </variablelist> - </sect1> Index: en/language/predefined/variables.xml =================================================================== RCS file: en/language/predefined/variables.xml diff -N en/language/predefined/variables.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.99 $ --> + +<reference xml:id="reserved.variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>Predefined variables</title> + + <partintro> + + <para> + PHP provides a large number of predefined variables to any script. The + variables represent everything from + <link linkend="language.variables.external">external variables</link> to + built-in enviroment variables, last error messages to last retrieved + headers. + </para> + + <section xml:id="language.variables.superglobals"> + <title>Superglobals</title> + <para> + Superglobals are built-in variables that are always available in all scopes. + These variables are: + <simplelist> + <member><varname>$GLOBALS</varname></member> + <member><varname>$_SERVER</varname></member> + <member><varname>$_GET</varname></member> + <member><varname>$_POST</varname></member> + <member><varname>$_FILES</varname></member> + <member><varname>$_COOKIE</varname></member> + <member><varname>$_SESSION</varname></member> + <member><varname>$_REQUEST</varname></member> + <member><varname>$_ENV</varname></member> + </simplelist> + </para> + <note> + <simpara> + Superglobals cannot be used as + <link linkend="language.variables.variable">variable variables</link> + inside functions or class methods. + </simpara> + </note> + </section> + + </partintro> + + &language.predefined.variables.globals; + &language.predefined.variables.server; + &language.predefined.variables.get; + &language.predefined.variables.post; + &language.predefined.variables.files; + &language.predefined.variables.request; + &language.predefined.variables.session; + &language.predefined.variables.env; + &language.predefined.variables.cookie; + &language.predefined.variables.phperrormsg; + &language.predefined.variables.httprawpostdata; + &language.predefined.variables.httpresponseheader; + &language.predefined.variables.argc; + &language.predefined.variables.argv; + +</reference> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/argc.xml =================================================================== RCS file: en/language/predefined/variables/argc.xml diff -N en/language/predefined/variables/argc.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/argc.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.argc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$argc</refname> + <refpurpose>The number of arguments passed to script</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + Contains the number of arguments passed to the current script when running + from the command line. + </para> + <note> + <simpara> + The scripts filename is always passed as an argument to the script + </simpara> + </note> + <note> + <simpara> + This variable is only available when <literal>register_argc_argv</literal> + is enabled in <filename>php.ini</filename>. + </simpara> + </note> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.argc.basic"><!-- {{{ --> + <title><varname>$argc</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +var_dump($argc); +?> +]]> + </programlisting> + <simpara> + When executing the example with: php script.php arg1 arg2 arg3 + </simpara> + &example.outputs.similar; + <screen> +<![CDATA[ +int(4) +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/argv.xml =================================================================== RCS file: en/language/predefined/variables/argv.xml diff -N en/language/predefined/variables/argv.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/argv.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.argv" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$argv</refname> + <refpurpose>Array of arguments passed to script</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + Contains an array of all the arguments passed to the script when running + from the command line. + </para> + <note> + <simpara> + The first argument is always the current scripts filename. + </simpara> + </note> + <note> + <simpara> + This variable is only available when <literal>register_argc_argv</literal> + is enabled in <filename>php.ini</filename>. + </simpara> + </note> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.argv.basic"><!-- {{{ --> + <title><varname>$argv</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +var_dump($argv); +?> +]]> + </programlisting> + <simpara> + When executing the example with: php script.php arg1 arg2 arg3 + </simpara> + &example.outputs.similar; + <screen> +<![CDATA[ +array(4) { + [0]=> + string(10) "script.php" + [1]=> + string(4) "arg1" + [2]=> + string(4) "arg2" + [3]=> + string(4) "arg3" +} +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/cookie.xml =================================================================== RCS file: en/language/predefined/variables/cookie.xml diff -N en/language/predefined/variables/cookie.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/cookie.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.cookies" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$_COOKIE</refname> + <refname>$HTTP_COOKIE_VARS</refname> + <refpurpose>HTTP Cookies</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + An associative array of variables passed to the current script + via HTTP Cookies. Automatically global in any scope. + </para> + + <simpara> + <varname>$HTTP_COOKIE_VARS</varname> contains the same initial + information, but is not a superglobal. (Note that + <varname>$HTTP_COOKIE_VARS</varname> and <varname>$_COOKIE</varname> + are different variables and that PHP handles them as such) + </simpara> + + <simpara> + If the <link + linkend="ini.register-globals">register_globals</link> directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + <varname>$_COOKIE</varname> and <varname>$HTTP_COOKIE_VARS</varname> + arrays. For related information, see the security chapter titled + <link linkend="security.globals">Using Register Globals</link>. + These individual globals are not superglobals. + </simpara> + + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.1.0</entry> + <entry> + Introduced <varname>$_COOKIE</varname>. + In previous the <varname>$HTTP_COOKIE_VARS</varname> + contained these information. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.cookie.basic"><!-- {{{ --> + <title><varname>$_COOKIE</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'Hello ' . htmlspecialchars($_COOKIE["name"]) . '!'; +?> +]]> + </programlisting> + <simpara> + Assuming the "name" cookie has been set earlier + </simpara> + &example.outputs.similar; + <screen> +<![CDATA[ +Hello Hannes! +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/env.xml =================================================================== RCS file: en/language/predefined/variables/env.xml diff -N en/language/predefined/variables/env.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/env.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.environment" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$_ENV</refname> + <refname>$HTTP_ENV_VARS</refname> + <refpurpose>Environment variables</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + An associative array of variables passed to the current script + via the environment method. Automatically global in any scope. + </para> + + <simpara> + These variables are imported into PHP's global namespace from the + environment under which the PHP parser is running. Many are + provided by the shell under which PHP is running and different + systems are likely running different kinds of shells, a + definitive list is impossible. Please see your shell's + documentation for a list of defined environment variables. + </simpara> + + <simpara> + Other environment variables include the CGI variables, placed + there regardless of whether PHP is running as a server module or + CGI processor. + </simpara> + + <simpara> + <varname>$HTTP_ENV_VARS</varname> contains the same initial + information, but is not a superglobal. (Note that + <varname>$HTTP_ENV_VARS</varname> and <varname>$_ENV</varname> + are different variables and that PHP handles them as such) + </simpara> + + <simpara> + If the <link + linkend="ini.register-globals">register_globals</link> directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + <varname>$_ENV</varname> and <varname>$HTTP_ENV_VARS</varname> + arrays. For related information, see the security chapter titled + <link linkend="security.globals">Using Register Globals</link>. + These individual globals are not superglobals. + </simpara> + + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.1.0</entry> + <entry> + Introduced <varname>$_ENV</varname>. + In previous the <varname>$HTTP_ENV_VARS</varname> + contained these information. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.env.basic"><!-- {{{ --> + <title><varname>$_ENV</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'My username is ' .$_ENV["user"] . '!'; +?> +]]> + </programlisting> + <simpara> + Assuming "bjori" executes this script + </simpara> + &example.outputs.similar; + <screen> +<![CDATA[ +My username is bjori! +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/files.xml =================================================================== RCS file: en/language/predefined/variables/files.xml diff -N en/language/predefined/variables/files.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/files.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.files" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$_FILES</refname> + <refname>$HTTP_POST_FILES</refname> + <refpurpose>HTTP File Upload variables</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + An associative array of items uploaded to the current script + via the HTTP POST method. Automatically global in any scope. + </para> + + <simpara> + <varname>$HTTP_POST_FILES</varname> contains the same initial + information, but is not a superglobal. (Note that + <varname>$HTTP_POST_FILES</varname> and <varname>$_FILES</varname> + are different variables and that PHP handles them as such) + </simpara> + + <simpara> + If the <link + linkend="ini.register-globals">register_globals</link> directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + <varname>$_FILES</varname> and <varname>$HTTP_POST_FILES</varname> + arrays. For related information, see the security chapter titled + <link linkend="security.globals">Using Register Globals</link>. + These individual globals are not superglobals. + </simpara> + + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.1.0</entry> + <entry> + Introduced <varname>$_FILES</varname>. + In previous the <varname>$HTTP_POST_FILES</varname> + contained these information. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/get.xml =================================================================== RCS file: en/language/predefined/variables/get.xml diff -N en/language/predefined/variables/get.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/get.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$_GET</refname> + <refname>$HTTP_GET_VARS</refname> + <refpurpose>HTTP GET variables</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + An associative array of variables passed to the current script + via the HTTP GET method. Automatically global in any scope. + </para> + + <simpara> + <varname>$HTTP_GET_VARS</varname> contains the same initial + information, but is not a superglobal. (Note that + <varname>$HTTP_GET_VARS</varname> and <varname>$_GET</varname> + are different variables and that PHP handles them as such) + </simpara> + + <simpara> + If the <link + linkend="ini.register-globals">register_globals</link> directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + <varname>$_GET</varname> and <varname>$HTTP_GET_VARS</varname> + arrays. For related information, see the security chapter titled + <link linkend="security.globals">Using Register Globals</link>. + These individual globals are not superglobals. + </simpara> + + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.1.0</entry> + <entry> + Introduced <varname>$_GET</varname>. + In previous the <varname>$HTTP_GET_VARS</varname> + contained these information. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.get.basic"><!-- {{{ --> + <title><varname>$_GET</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!'; +?> +]]> + </programlisting> + <simpara> + Assuming the user entered http://example.com/?name=Hannes + </simpara> + &example.outputs.similar; + <screen> +<![CDATA[ +Hello Hannes! +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/globals.xml =================================================================== RCS file: en/language/predefined/variables/globals.xml diff -N en/language/predefined/variables/globals.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/globals.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="variable.globals" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$GLOBALS</refname> + <refpurpose>References all variables available in global scope</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + An associative array containing references to all variables which + are currently defined in the global scope of the script. The + variable names are the keys of the array. + </para> + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>Enter the version of change here</entry> + <entry> + Describe the change + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.globals.basic"><!-- {{{ --> + <title><varname>$GLOBALS</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +function test() { + $foo = "local variable"; + + echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; + echo '$foo in current scope: ' . $foo . "\n"; +} + +$foo = "Example content"; +test(); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +$foo in global scope: Example content +$foo in current scope: local variable +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/httprawpostdata.xml =================================================================== RCS file: en/language/predefined/variables/httprawpostdata.xml diff -N en/language/predefined/variables/httprawpostdata.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/httprawpostdata.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.httprawpostdata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$HTTP_RAW_POST_DATA</refname> + <refpurpose>Raw POST data</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + <varname>$HTTP_RAW_POST_DATA</varname> contains the raw POST data. + See <link linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link> + </para> + </refsect1><!-- }}} --> +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/httpresponseheader.xml =================================================================== RCS file: en/language/predefined/variables/httpresponseheader.xml diff -N en/language/predefined/variables/httpresponseheader.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/httpresponseheader.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.httpresponseheader" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$http_response_header</refname> + <refpurpose>HTTP response headers</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + The <varname>$http_response_header</varname> array is similiar to the + <function>get_headers</function> function. When using the + <link linkend="wrappers.http">HTTP wrapper</link> + <varname>$http_response_header</varname> will be populated with the HTTP + response headers. + </para> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.httpresponseheader.basic"><!-- {{{ --> + <title><varname>$http_response_header</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +file_get_contents("http://example.com"); +var_dump($http_response_header); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +array(9) { + [0]=> + string(15) "HTTP/1.1 200 OK" + [1]=> + string(35) "Date: Sat, 12 Apr 2008 17:30:38 GMT" + [2]=> + string(29) "Server: Apache/2.2.3 (CentOS)" + [3]=> + string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT" + [4]=> + string(27) "ETag: "280100-1b6-80bfd280"" + [5]=> + string(20) "Accept-Ranges: bytes" + [6]=> + string(19) "Content-Length: 438" + [7]=> + string(17) "Connection: close" + [8]=> + string(38) "Content-Type: text/html; charset=UTF-8" +} +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/phperrormsg.xml =================================================================== RCS file: en/language/predefined/variables/phperrormsg.xml diff -N en/language/predefined/variables/phperrormsg.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/phperrormsg.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.phperrormsg" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$php_errormsg</refname> + <refpurpose>The previous error message</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + <varname>$php_errormsg</varname> is a variable containing the + text of the last error message generated by PHP. This variable + will only be available within the scope in which the error + occurred, and only if the <link + linkend="ini.track-errors">track_errors</link> configuration + option is turned on (it defaults to off). + </para> + <note> + <simpara> + This variable is only available when <literal>track_errors</literal> is + enabled in <filename>php.ini</filename>. + </simpara> + </note> + <warning> + <simpara> + If a <link linkend="function.set-error-handler">user defined error handler</link> + is set <varname>$php_erromsg</varname> is only set if the error handler + returns &false; + </simpara> + </warning> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.phperrormsg.basic"><!-- {{{ --> + <title><varname>$php_errormsg</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +@strpos(); +echo $php_errormsg; +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Wrong parameter count for strpos() +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/post.xml =================================================================== RCS file: en/language/predefined/variables/post.xml diff -N en/language/predefined/variables/post.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/post.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.post" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$_POST</refname> + <refname>$HTTP_POST_VARS</refname> + <refpurpose>HTTP POST variables</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + An associative array of variables passed to the current script + via the HTTP POST method. Automatically global in any scope. + </para> + + <simpara> + <varname>$HTTP_POST_VARS</varname> contains the same initial + information, but is not a superglobal. (Note that + <varname>$HTTP_POST_VARS</varname> and <varname>$_POST</varname> + are different variables and that PHP handles them as such) + </simpara> + + <simpara> + If the <link + linkend="ini.register-globals">register_globals</link> directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + <varname>$_POST</varname> and <varname>$HTTP_POST_VARS</varname> + arrays. For related information, see the security chapter titled + <link linkend="security.globals">Using Register Globals</link>. + These individual globals are not superglobals. + </simpara> + + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.1.0</entry> + <entry> + Introduced <varname>$_POST</varname>. + In previous the <varname>$HTTP_POST_VARS</varname> + contained these information. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.post.basic"><!-- {{{ --> + <title><varname>$_POST</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!'; +?> +]]> + </programlisting> + <simpara> + Assuming the user POSTed name=Hannes + </simpara> + &example.outputs.similar; + <screen> +<![CDATA[ +Hello Hannes! +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/request.xml =================================================================== RCS file: en/language/predefined/variables/request.xml diff -N en/language/predefined/variables/request.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/request.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.request" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$_REQUEST</refname> + <refpurpose>Request variables</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + An associative array consisting of the contents of + <varname>$_GET</varname>, <varname>$_POST</varname>, + and <varname>$_COOKIE</varname>. Automatically global in any scope. + </para> + + <simpara> + Variables provided to the script via the GET, POST, and COOKIE input + mechanisms, and which therefore cannot be trusted. The presence and + order of variable inclusion in this array is defined according to the + PHP <link linkend="ini.variables-order">variables_order</link> + configuration directive. This array has no direct analogue in versions + of PHP prior to 4.1.0. + </simpara> + + <simpara> + When running on the <link linkend="features.commandline">command line + </link>, this will <emphasis>not</emphasis> include the + <varname>argv</varname> and <varname>argc</varname> entries; these are + present in the <varname>$_SERVER</varname> array. + </simpara> + + <simpara> + If the <link + linkend="ini.register-globals">register_globals</link> directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + <varname>$_REQUEST</varname> array. For related information, see + the security chapter titled <link + linkend="security.globals">Using Register + Globals</link>. These individual globals are not superglobals. + </simpara> + + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.3.0</entry> + <entry> + <varname>$_FILES</varname> information was removed from + <varname>$_REQUEST</varname>. + </entry> + </row> + <row> + <entry>4.1.0</entry> + <entry> + Introduced <varname>$_REQUEST</varname>. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + + <refsect1 role="seealso"> + &reftitle.seealso; + <simplelist> + <member><function>import_request_variables</function></member> + </simplelist> + </refsect1> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/server.xml =================================================================== RCS file: en/language/predefined/variables/server.xml diff -N en/language/predefined/variables/server.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/server.xml 12 Apr 2008 19:59:12 -0000 @@ -0,0 +1,560 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.server" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$_SERVER</refname> + <refname>$HTTP_SERVER_VARS</refname> + <refpurpose>Server and execution enviroment information</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + <varname>$_SERVER</varname> is an array containing information + such as headers, paths, and script locations. The entries in this + array are created by the web server. There is no guarantee that + every web server will provide any of these; servers may omit some, + or provide others not listed here. That said, a large number of + these variables are accounted for in the <link + xlink:href="&url.cgispec;">CGI 1.1 specification</link>, so you should + be able to expect those. + </para> + + <simpara> + <varname>$HTTP_SERVER_VARS</varname> contains the same initial + information, but is not a superglobal. (Note that + <varname>$HTTP_SERVER_VARS</varname> and <varname>$_SERVER</varname> + are different variables and that PHP handles them as such) + </simpara> + + <simpara> + If the <link + linkend="ini.register-globals">register_globals</link> directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + <varname>$_SERVER</varname> and <varname>$HTTP_SERVER_VARS</varname> + arrays. For related information, see the security chapter titled + <link linkend="security.globals">Using Register Globals</link>. + These individual globals are not superglobals. + </simpara> + + <simpara> + You may or may not find any of the following elements in + $_SERVER. Note that few, if any, of these will be available (or + indeed have any meaning) if running PHP on the command line. + </simpara> + + <para> + <variablelist> + <varlistentry> + <term>'<varname>PHP_SELF</varname>'</term> + <listitem> + <simpara> + The filename of the currently executing script, relative to + the document root. For instance, + <varname>$_SERVER['PHP_SELF']</varname> in a script at the + address <filename>http://example.com/test.php/foo.bar</filename> + would be <filename>/test.php/foo.bar</filename>. + The <link linkend="language.constants.predefined">__FILE__</link> + constant contains the full path and filename of the current (i.e. + included) file. + </simpara> + <simpara> + If PHP is running as a command-line processor this variable contains + the script name since PHP 4.3.0. Previously it was not available. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>argv</varname>'</term> + <listitem> + <simpara> + Array of arguments passed to the script. When the script is + run on the command line, this gives C-style access to the + command line parameters. When called via the GET method, this + will contain the query string. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>argc</varname>'</term> + <listitem> + <simpara> + Contains the number of command line parameters passed to the + script (if run on the command line). + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>GATEWAY_INTERFACE</varname>'</term> + <listitem> + <simpara> + What revision of the CGI specification the server is using; + i.e. '<literal>CGI/1.1</literal>'. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SERVER_ADDR</varname>'</term> + <listitem> + <simpara> + The IP address of the server under which the current script is + executing. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SERVER_NAME</varname>'</term> + <listitem> + <simpara> + The name of the server host under which the current script is + executing. If the script is running on a virtual host, this + will be the value defined for that virtual host. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SERVER_SOFTWARE</varname>'</term> + <listitem> + <simpara> + Server identification string, given in the headers when + responding to requests. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SERVER_PROTOCOL</varname>'</term> + <listitem> + <simpara> + Name and revision of the information protocol via which the + page was requested; i.e. '<literal>HTTP/1.0</literal>'; + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>REQUEST_METHOD</varname>'</term> + <listitem> + <simpara> + Which request method was used to access the page; i.e. '<literal>GET</literal>', + '<literal>HEAD</literal>', '<literal>POST</literal>', '<literal>PUT</literal>'. + </simpara> + <note> + <para> + PHP script is terminated after sending headers (it means after + producing any output without output buffering) if the request method + was <literal>HEAD</literal>. + </para> + </note> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>REQUEST_TIME</varname>'</term> + <listitem> + <simpara> + The timestamp of the start of the request. Available since PHP 5.1.0. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>QUERY_STRING</varname>'</term> + <listitem> + <simpara> + The query string, if any, via which the page was accessed. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>DOCUMENT_ROOT</varname>'</term> + <listitem> + <simpara> + The document root directory under which the current script is + executing, as defined in the server's configuration file. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTP_ACCEPT</varname>'</term> + <listitem> + <simpara> + Contents of the <literal>Accept:</literal> header from the + current request, if there is one. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTP_ACCEPT_CHARSET</varname>'</term> + <listitem> + <simpara> + Contents of the <literal>Accept-Charset:</literal> header + from the current request, if there is one. Example: + '<literal>iso-8859-1,*,utf-8</literal>'. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTP_ACCEPT_ENCODING</varname>'</term> + <listitem> + <simpara> + Contents of the <literal>Accept-Encoding:</literal> header + from the current request, if there is one. Example: '<literal>gzip</literal>'. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTP_ACCEPT_LANGUAGE</varname>'</term> + <listitem> + <simpara> + Contents of the <literal>Accept-Language:</literal> header + from the current request, if there is one. Example: '<literal>en</literal>'. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTP_CONNECTION</varname>'</term> + <listitem> + <simpara> + Contents of the <literal>Connection:</literal> header from + the current request, if there is one. Example: '<literal>Keep-Alive</literal>'. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTP_HOST</varname>'</term> + <listitem> + <simpara> + Contents of the <literal>Host:</literal> header from the + current request, if there is one. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTP_REFERER</varname>'</term> + <listitem> + <simpara> + The address of the page (if any) which referred the user + agent to the current page. This is set by the user agent. Not + all user agents will set this, and some provide the ability + to modify <varname>HTTP_REFERER</varname> as a feature. In + short, it cannot really be trusted. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTP_USER_AGENT</varname>'</term> + <listitem> + <simpara> + Contents of the <literal>User-Agent:</literal> header from + the current request, if there is one. This is a string + denoting the user agent being which is accessing the page. A + typical example is: <computeroutput>Mozilla/4.5 [en] (X11; U; + Linux 2.2.9 i586)</computeroutput>. Among other things, you + can use this value with <function>get_browser</function> to + tailor your page's output to the capabilities of the user + agent. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>HTTPS</varname>'</term> + <listitem> + <simpara> + Set to a non-empty value if the script was queried through the HTTPS + protocol. + </simpara> + <simpara> + Note that when using ISAPI with IIS, the value will be + <literal>off</literal> if the request was not made through the HTTPS + protocol. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>REMOTE_ADDR</varname>'</term> + <listitem> + <simpara> + The IP address from which the user is viewing the current + page. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>REMOTE_HOST</varname>'</term> + <listitem> + <simpara> + The Host name from which the user is viewing the current + page. The reverse dns lookup is based off the + <varname>REMOTE_ADDR</varname> of the user. + </simpara> + <note> + <simpara> + Your web server must be configured to create this variable. For + example in Apache you'll need <literal>HostnameLookups On</literal> + inside &httpd.conf; for it to exist. See also + <function>gethostbyaddr</function>. + </simpara> + </note> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>REMOTE_PORT</varname>'</term> + <listitem> + <simpara> + The port being used on the user's machine to communicate with + the web server. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SCRIPT_FILENAME</varname>'</term> + <listitem> + <para> + The absolute pathname of the currently executing script. + <note> + <para> + If a script is executed with the CLI, as a relative path, + such as <filename>file.php</filename> or + <filename>../file.php</filename>, + <varname>$_SERVER['SCRIPT_FILENAME']</varname> will + contain the relative path specified by the user. + </para> + </note> + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SERVER_ADMIN</varname>'</term> + <listitem> + <simpara> + The value given to the SERVER_ADMIN (for Apache) directive in + the web server configuration file. If the script is running + on a virtual host, this will be the value defined for that + virtual host. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SERVER_PORT</varname>'</term> + <listitem> + <simpara> + The port on the server machine being used by the web server + for communication. For default setups, this will be '<literal>80</literal>'; + using SSL, for instance, will change this to whatever your + defined secure HTTP port is. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SERVER_SIGNATURE</varname>'</term> + <listitem> + <simpara> + String containing the server version and virtual host name + which are added to server-generated pages, if enabled. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PATH_TRANSLATED</varname>'</term> + <listitem> + <simpara> + Filesystem- (not document root-) based path to the current + script, after the server has done any virtual-to-real + mapping. + </simpara> + <note> + <simpara> + As of PHP 4.3.2, <envar>PATH_TRANSLATED</envar> is no longer set + implicitly under the Apache 2 <acronym>SAPI</acronym> in contrast + to the situation in Apache 1, where it's set to the same value as + the <envar>SCRIPT_FILENAME</envar> server variable when it's not + populated by Apache. This change was made to comply with the + <acronym>CGI</acronym> specification that + <envar>PATH_TRANSLATED</envar> should only exist if + <envar>PATH_INFO</envar> is defined. + </simpara> + <simpara> + Apache 2 users may use <literal>AcceptPathInfo = On</literal> inside + <filename>httpd.conf</filename> to define <envar>PATH_INFO</envar>. + </simpara> + </note> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>SCRIPT_NAME</varname>'</term> + <listitem> + <simpara> + Contains the current script's path. This is useful for pages + which need to point to themselves. + The <link linkend="language.constants.predefined">__FILE__</link> + constant contains the full path and filename of the current (i.e. + included) file. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>REQUEST_URI</varname>'</term> + <listitem> + <simpara> + The URI which was given in order to access this page; for + instance, '<literal>/index.html</literal>'. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_DIGEST</varname>'</term> + <listitem> + <simpara> + When running under Apache as module doing Digest HTTP authentication + this variable is set to the 'Authorization' header sent by the + client (which you should then use to make the appropriate + validation). + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_USER</varname>'</term> + <listitem> + <simpara> + When running under Apache or IIS (ISAPI on PHP 5) as module doing + HTTP authentication this variable is set to the username provided by + the user. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>PHP_AUTH_PW</varname>'</term> + <listitem> + <simpara> + When running under Apache or IIS (ISAPI on PHP 5) as module doing + HTTP authentication this variable is set to the password provided by + the user. + </simpara> + </listitem> + </varlistentry> + + <varlistentry> + <term>'<varname>AUTH_TYPE</varname>'</term> + <listitem> + <simpara> + When running under Apache as module doing HTTP authenticated this + variable is set to the authentication type. + </simpara> + </listitem> + </varlistentry> + + </variablelist> + </para> + + + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.1.0</entry> + <entry> + Introduced <varname>$_SERVER</varname>. + In previous versions the <varname>$HTTP_SERVER_VARS</varname> + contained these information. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="variable.server.basic"><!-- {{{ --> + <title><varname>$_SERVER</varname> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +var_dump($_SERVER["SERVER_NAME"]); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +www.php.net +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + Index: en/language/predefined/variables/session.xml =================================================================== RCS file: en/language/predefined/variables/session.xml diff -N en/language/predefined/variables/session.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ en/language/predefined/variables/session.xml 12 Apr 2008 19:59:13 -0000 @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.1 $ --> + +<refentry xml:id="reserved.variables.session" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <refnamediv> + <refname>$_SESSION</refname> + <refname>$HTTP_SESSION_VARS</refname> + <refpurpose>Session variables</refpurpose> + </refnamediv> + + <refsect1 role="description"><!-- {{{ --> + &reftitle.description; + <para> + An associative array containing session variables available to + the current script. See the <link linkend="ref.session">Session + functions</link> documentation for more information on how this + is used. + </para> + + <simpara> + <varname>$HTTP_SESSION_VARS</varname> contains the same initial + information, but is not a superglobal. (Note that + <varname>$HTTP_SESSION_VARS</varname> and <varname>$_SESSION</varname> + are different variables and that PHP handles them as such) + </simpara> + + <simpara> + If the <link + linkend="ini.register-globals">register_globals</link> directive + is set, then these variables will also be made available in the + global scope of the script; i.e., separate from the + <varname>$_SESSION</varname> and <varname>$HTTP_SESSION_VARS</varname> + arrays. For related information, see the security chapter titled + <link linkend="security.globals">Using Register Globals</link>. + These individual globals are not superglobals. + </simpara> + + </refsect1><!-- }}} --> + + + <refsect1 role="changelog"><!-- {{{ --> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.1.0</entry> + <entry> + Introduced <varname>$_SESSION</varname>. + In previous the <varname>$HTTP_SESSION_VARS</varname> + contained these information. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1><!-- }}} --> + + <refsect1 role="notes"><!-- {{{ --> + &reftitle.notes; + &note.is-superglobal; + </refsect1><!-- }}} --> + +</refentry> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> +
« previous php.doc (#969378779) next »