mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Updated example to handle "deep" arrays
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@162778 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
7041853c56
commit
f01da4d71d
1 changed files with 13 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- splitted from ./en/functions/info.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.get-magic-quotes-gpc">
|
||||
<refnamediv>
|
||||
|
@ -70,9 +70,18 @@ $sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')";
|
|||
<![CDATA[
|
||||
<?php
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$_POST = array_map('stripslashes', $_POST);
|
||||
$_GET = array_map('stripslashes', $_GET);
|
||||
$_COOKIE = array_map('stripslashes', $_COOKIE);
|
||||
function stripslashes_deep($value)
|
||||
{
|
||||
$value = is_array($value) ?
|
||||
array_map('stripslashes_deep', $value) :
|
||||
stripslashes($value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
$_POST = array_map('stripslashes_deep', $_POST);
|
||||
$_GET = array_map('stripslashes_deep', $_GET);
|
||||
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue