1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

Improved part that mentions register_globals and magic_quotes

This closes https://github.com/php/doc-en/issues/4503
This commit is contained in:
philip
2025-03-05 09:35:47 -08:00
parent b8f3ae7da3
commit f0ed705e1a

View File

@@ -71,13 +71,24 @@ exec ($evil_var);
improve it.
</para>
<para>
You may also want to consider turning off register_globals,
magic_quotes, or other convenience settings which may confuse
you as to the validity, source, or value of a given variable.
Working with <acronym>PHP</acronym> in error_reporting(E_ALL) mode can also help warn
you about variables being used before they are checked or
initialized (so you can prevent unusual data from being
operated upon).
Improve security by disabling convenience settings that obscure input
data's origin, validity, or integrity. Implicit variable creation and
unchecked input can lead to vulnerabilities like injection attacks and
data manipulation.
</para>
<para>
Features like <literal>register_globals</literal> and
<literal>magic_quotes</literal> (both removed in PHP 5.4.0) once contributed
to these risks by automatically creating variables from user input and
escaping data inconsistently. While no longer in PHP, similar risks persist
if input handling is mismanaged.
</para>
<para>
Enable <link linkend="function.error-reporting">error_reporting(E_ALL)</link> to
help detect uninitialized variables and validate input. Use strict types
(<link linkend="language.types.declarations.strict">declare(strict_types=1)</link>,
introduced in PHP 7) to enforce type safety, prevent unintended type conversions,
and improving overall security.
</para>
</chapter>