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

 ID:                 31862
 Updated by:         [email protected]
 Reported by:        php at koterov dot ru
 Summary:            Ability to turn off magic_quotes for parse_str().
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   all
 PHP Version:        4.3.10
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Closing as magic quotes were dropped in PHP 5.4.


Previous Comments:
------------------------------------------------------------------------
[2006-12-14 12:24:11] jdespatis at yahoo dot fr

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)

------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=31862&edit=1

Reply via email to