2001-11-10 21:49:43 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2005-08-14 21:58:52 +00:00
|
|
|
<!-- $Revision: 1.25 $ -->
|
2001-07-20 18:12:03 +00:00
|
|
|
<chapter id="faq.misc">
|
2001-07-21 11:42:27 +00:00
|
|
|
<title>Miscellaneous Questions</title>
|
|
|
|
<titleabbrev>Miscellaneous Questions</titleabbrev>
|
2001-07-20 18:12:03 +00:00
|
|
|
|
|
|
|
<para>
|
2001-07-21 11:42:27 +00:00
|
|
|
There can be some questions we can't put into other
|
|
|
|
categories. Here you can find them.
|
2001-07-20 18:12:03 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<qandaset>
|
2002-02-23 13:24:08 +00:00
|
|
|
<qandaentry id="faq.misc.bz2">
|
|
|
|
<question>
|
|
|
|
<para>
|
|
|
|
How can I handle the bz2 compressed manuals on Windows?
|
|
|
|
</para>
|
|
|
|
</question>
|
|
|
|
<answer>
|
|
|
|
<para>
|
|
|
|
If you don't have an archiver-tool to handle bz2 files
|
2003-02-04 09:38:22 +00:00
|
|
|
<ulink url="&url.bzip2;">download</ulink> the commandline tool
|
2002-04-11 21:53:57 +00:00
|
|
|
from Redhat (please find further information below).
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If you would not like to use a command line tool, you can try free
|
2003-02-04 09:38:22 +00:00
|
|
|
tools like <ulink url="&url.stuffit;">Stuffit Expander</ulink>,
|
|
|
|
<ulink url="&url.ultimatezip;">UltimateZip</ulink>,
|
|
|
|
<ulink url="&url.7zip;">7-Zip</ulink>, or
|
|
|
|
<ulink url="&url.quickzip;">Quick Zip</ulink>. If you
|
|
|
|
have tools like <ulink url="&url.winrar;">WinRAR</ulink> or
|
|
|
|
<ulink url="&url.powerarchiver;">Power Archiver</ulink>, you can
|
2004-08-04 12:37:37 +00:00
|
|
|
easily decompress the bz2 files with it. If you use Total Commander
|
|
|
|
(formerly Windows Commander),
|
2002-04-11 21:53:57 +00:00
|
|
|
a bz2 plugin for that program is available freely from the
|
2004-08-04 12:37:37 +00:00
|
|
|
<ulink url="&url.wincmd;">Total Commander</ulink> site.
|
2002-04-11 21:53:57 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The bzip2 commandline tool from Redhat:
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Win2k Sp2 users grab the latest version 1.0.2, all
|
2002-02-23 15:36:45 +00:00
|
|
|
other Windows user should grab version 1.00. After downloading rename
|
|
|
|
the executable to bzip2.exe. For convenience put it into a directory in
|
|
|
|
your path, e.g. C:\Windows where C represents your windows installation
|
|
|
|
drive.
|
2002-02-23 13:24:08 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2002-02-23 15:36:45 +00:00
|
|
|
Note: lang stands for your language and x for the desired format, e.g.: pdf.
|
2002-02-24 10:48:05 +00:00
|
|
|
To uncompress the php_manual_lang.x.bz2 follow these simple instructions:
|
|
|
|
<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<simpara>open a command prompt window</simpara>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<simpara>
|
|
|
|
cd to the folder where you stored the
|
|
|
|
downloaded php_manual_lang.x.bz2
|
|
|
|
</simpara>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<simpara>
|
|
|
|
invoke bzip2 -d php_manual_lang.x.bz2, extracting
|
|
|
|
php_manual_lang.x in the same folder
|
|
|
|
</simpara>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
2002-02-23 13:24:08 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2002-02-24 10:48:05 +00:00
|
|
|
In case you downloaded the php_manual_lang.tar.bz2 with many html-files
|
|
|
|
in it, the procedure is the same. The only difference is that you got a file
|
2002-02-23 15:36:45 +00:00
|
|
|
php_manual_lang.tar. The tar format is known to be treated with most
|
2002-02-24 10:48:05 +00:00
|
|
|
common archivers on Windows like e.g.
|
2003-02-04 09:38:22 +00:00
|
|
|
<ulink url="&url.winzip;">WinZip</ulink>.
|
2002-02-24 10:48:05 +00:00
|
|
|
</para>
|
2002-02-23 13:24:08 +00:00
|
|
|
</answer>
|
|
|
|
</qandaentry>
|
2004-08-04 13:07:41 +00:00
|
|
|
|
|
|
|
<qandaentry id="faq.misc.arguments.references">
|
|
|
|
<question>
|
|
|
|
<para>
|
|
|
|
What does & beside argument mean in function declaration of e.g.
|
|
|
|
<function>asort</function>?
|
|
|
|
</para>
|
|
|
|
</question>
|
|
|
|
<answer>
|
|
|
|
<para>
|
|
|
|
It means that the argument is
|
|
|
|
<link linkend="language.references.pass">passed by reference</link> and
|
|
|
|
the function will likely modify it corresponding to the documentation. You
|
|
|
|
can pass only variables this way and you don't need to pass them with
|
|
|
|
& in function call (it's even
|
|
|
|
<link linkend="ini.allow-call-time-pass-reference">deprecated</link>).
|
|
|
|
</para>
|
|
|
|
</answer>
|
|
|
|
</qandaentry>
|
|
|
|
|
2004-09-11 10:28:27 +00:00
|
|
|
<qandaentry id="faq.misc.registerglobals">
|
|
|
|
<question>
|
|
|
|
<para>
|
2004-09-11 10:49:25 +00:00
|
|
|
How do I deal with <literal>register_globals</literal>?
|
2004-09-11 10:28:27 +00:00
|
|
|
</para>
|
|
|
|
</question>
|
|
|
|
<answer>
|
2004-09-11 13:46:42 +00:00
|
|
|
<para>
|
|
|
|
For information about the security implications of
|
|
|
|
<literal>register_globals</literal>, read the security chapter on
|
|
|
|
<link linkend="security.globals">Using register_globals</link>.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
It's preferred to use
|
|
|
|
<link linkend="language.variables.superglobals">superglobals</link>,
|
|
|
|
rather than relying upon <literal>register_globals</literal> being on.
|
|
|
|
</para>
|
2004-09-11 10:49:25 +00:00
|
|
|
<para>
|
|
|
|
If you are on a shared host with <literal>register_globals</literal> turned
|
|
|
|
off and need to use some legacy applications, which require this option
|
|
|
|
to be turned on, or you are on some hosting server, where this feature
|
|
|
|
is turned on, but you would like to eliminate security risks, you might
|
|
|
|
need to emulate the opposite setting with PHP. It is always a good idea to
|
|
|
|
first ask if it would be possible to change the option somehow in PHP's
|
|
|
|
configuration, but if it is not possible, then you can use these
|
|
|
|
compatibility snippets.
|
|
|
|
</para>
|
2004-09-11 13:34:02 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title>Emulating Register Globals</title>
|
|
|
|
<para>
|
|
|
|
This will emulate register_globals On.
|
|
|
|
</para>
|
|
|
|
<programlisting role="php">
|
2004-09-11 10:28:27 +00:00
|
|
|
<![CDATA[
|
2004-11-25 02:51:16 +00:00
|
|
|
<?php
|
2004-09-11 10:28:27 +00:00
|
|
|
// Emulate register_globals on
|
|
|
|
if (!ini_get('register_globals')) {
|
|
|
|
$superglobals = array($_SERVER, $_ENV,
|
|
|
|
$_FILES, $_COOKIE, $_POST, $_GET);
|
|
|
|
if (isset($_SESSION)) {
|
|
|
|
array_unshift($superglobals, $_SESSION);
|
|
|
|
}
|
|
|
|
foreach ($superglobals as $superglobal) {
|
|
|
|
extract($superglobal, EXTR_SKIP);
|
|
|
|
}
|
|
|
|
}
|
2004-11-25 02:51:16 +00:00
|
|
|
?>
|
2004-09-11 10:28:27 +00:00
|
|
|
]]>
|
2004-09-11 13:34:02 +00:00
|
|
|
</programlisting>
|
|
|
|
<para>
|
2005-08-14 21:58:52 +00:00
|
|
|
This will emulate register_globals Off. Keep in mind, that this code should be called in the very beginning of your script.
|
2004-09-11 13:34:02 +00:00
|
|
|
</para>
|
|
|
|
<programlisting role="php">
|
2004-09-11 10:28:27 +00:00
|
|
|
<![CDATA[
|
2004-11-25 02:51:16 +00:00
|
|
|
<?php
|
2004-09-11 10:28:27 +00:00
|
|
|
// Emulate register_globals off
|
2005-08-14 21:58:52 +00:00
|
|
|
function unregister_GLOBALS()
|
|
|
|
{
|
|
|
|
if (!ini_get('register_globals')) {
|
|
|
|
return;
|
2004-09-11 10:28:27 +00:00
|
|
|
}
|
2005-08-14 21:58:52 +00:00
|
|
|
|
|
|
|
// Might want to change this perhaps to a nicer error
|
|
|
|
if (isset($_REQUEST['GLOBALS'])) {
|
|
|
|
die('GLOBALS overwrite attempt detected');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Variables that shouldn't be unset
|
|
|
|
$noUnset = array('GLOBALS', '_GET',
|
|
|
|
'_POST', '_COOKIE',
|
|
|
|
'_REQUEST', '_SERVER',
|
|
|
|
'_ENV', '_FILES');
|
|
|
|
|
|
|
|
$input = array_merge($_GET, $_POST,
|
|
|
|
$_COOKIE, $_SERVER,
|
|
|
|
$_ENV, $_FILES,
|
|
|
|
isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
|
|
|
|
|
|
|
|
foreach ($input as $k => $v) {
|
|
|
|
if (!in_array($k, $noUnset) && isset($GLOBALS[$k])) {
|
|
|
|
unset($GLOBALS[$k]);
|
2004-09-11 10:28:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-08-14 21:58:52 +00:00
|
|
|
|
|
|
|
unregister_GLOBALS();
|
|
|
|
|
2004-11-25 02:51:16 +00:00
|
|
|
?>
|
2004-09-11 10:28:27 +00:00
|
|
|
]]>
|
2004-09-11 13:34:02 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2004-09-11 10:28:27 +00:00
|
|
|
</answer>
|
|
|
|
</qandaentry>
|
2001-07-20 18:12:03 +00:00
|
|
|
</qandaset>
|
|
|
|
</chapter>
|
|
|
|
|
2001-09-21 22:47:49 +00:00
|
|
|
<!-- 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
|
2001-12-12 20:47:43 +00:00
|
|
|
indent-tabs-mode:nil
|
2001-09-21 22:47:49 +00:00
|
|
|
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
|
|
|
|
-->
|