Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1521

Re: magic_quotes_gpc() on or off?

From "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Newsgroups comp.lang.php
Subject Re: magic_quotes_gpc() on or off?
Date 2011-05-11 16:13 +0200
Organization http://alvaro.es/
Message-ID <iqe5hs$2il$1@dont-email.me> (permalink)
References <92us45F6n8U1@mid.individual.net> <iqdpbt$bju$1@dont-email.me> <92vblcFsnvU2@mid.individual.net>

Show all headers | View raw


El 11/05/2011 13:53, Simon escribió/wrote:
>> If $data really comes from GET/POST/COOKIE and the original value is
>> «H\hi», you should have «H\\hi».
>
> So you saying that stripslashes(...) should be called on GET/POST/COOKIE
> rather than on any data?
>
> This certainly makes more sense to me, but the doc is not entirely clear
> about that, or I am just not reading it properly.

Well, yes, of course, that's what the "_gpc" suffix stands for:

«Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When 
magic_quotes are on, all ' (single-quote), " (double quote), \ 
(backslash) and NUL's are escaped with a backslash automatically.»

http://es.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc

It was already bad enough that way :)

>> Inspect its value with var_dump() and make sure it's actually coming
>> from $_GET, $_POST or $_COOKIE.
>>
>> Also, have a look at the register_globals directive. If you rely on it,
>> you can never be sure of where your variable comes from.
>>
>>
>
> Will do, thanks


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

magic_quotes_gpc() on or off? Simon <bad@example.com> - 2011-05-11 09:28 +0200
  Re: magic_quotes_gpc() on or off? Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-11 06:38 -0400
    Re: magic_quotes_gpc() on or off? Simon <bad@example.com> - 2011-05-11 13:49 +0200
      Re: magic_quotes_gpc() on or off? Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-11 11:29 -0400
        Re: magic_quotes_gpc() on or off? Michael Fesser <netizen@gmx.de> - 2011-05-13 21:25 +0200
          Re: magic_quotes_gpc() on or off? Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-13 18:44 -0400
  Re: magic_quotes_gpc() on or off? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-05-11 12:45 +0200
    Re: magic_quotes_gpc() on or off? Simon <bad@example.com> - 2011-05-11 13:53 +0200
      Re: magic_quotes_gpc() on or off? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-05-11 16:13 +0200
        Re: magic_quotes_gpc() on or off? Simon <bad@example.com> - 2011-05-11 16:15 +0200

csiph-web