ID:               31862
 Comment by:       jdespatis at yahoo dot fr
 Reported By:      php at koterov dot ru
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: all
 PHP Version:      4.3.10
 New Comment:

Hi, i have the same need

In fact, I encode an array into a query string thanks to
http_build_query()

and i want to get my array back, so i use parse_str, however, this
function protects slash if magic quotes is ON

AND it's impossible in a script to set the magic quotes to off, so it's
impossible to tell parse_str not to protect the slashes, i have to do a
little loop after to strip slashes

Should be nice to add an extra param to this function to say if yes or
no slashes should be protected, instead of using the configuration of
magic quotes (that can't be changed at runtime)


Previous Comments:
------------------------------------------------------------------------

[2005-02-06 20:54:30] php at koterov dot ru

Description:
------------
parse_str() always quotes arguments when magic_quotes_gpc is active on
startup (php.ini or .htaccess configured). But seems I cannot SWITCH
OFF magic_quotes_gpc on runtime FOR parse_str(). (I understand that it
is useless to try to switch off magic_quotes_gpc for purposes other
than parse_str!).

Seems it's a restriction of ini_set(), not parse_str() itself.

Reproduce code:
---------------
<?php
# magic_quotes_gpc MUST be ON in .htaccess or php.ini!
$qs = 'a="b"';
ini_set("magic_quotes_gpc", 0);
parse_str($qs, $p);
echo "<pre>".print_r($p, 1)."</pre>";
?>

Expected result:
----------------
Array
(
    [a] => "b"
)



Actual result:
--------------
Array
(
    [a] => \"b\"
)




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31862&edit=1

Reply via email to