@@ -75,7 +75,14 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = array(),
7575 parent ::initialize ($ dispatcher , $ parameters , $ attributes , $ options );
7676
7777 // GET parameters
78- $ this ->getParameters = get_magic_quotes_gpc () ? sfToolkit::stripslashesDeep ($ _GET ) : $ _GET ;
78+ if (version_compare (PHP_VERSION , '5.4 ' , '< ' ) && get_magic_quotes_gpc ())
79+ {
80+ $ this ->getParameters = sfToolkit::stripslashesDeep ($ _GET );
81+ }
82+ else
83+ {
84+ $ this ->getParameters = $ _GET ;
85+ }
7986 $ this ->parameterHolder ->add ($ this ->getParameters );
8087
8188 $ postParameters = $ _POST ;
@@ -148,7 +155,15 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = array(),
148155 $ this ->setMethod (self ::GET );
149156 }
150157
151- $ this ->postParameters = get_magic_quotes_gpc () ? sfToolkit::stripslashesDeep ($ postParameters ) : $ postParameters ;
158+ if (version_compare (PHP_VERSION , '5.4 ' , '< ' ) && get_magic_quotes_gpc ())
159+ {
160+ $ this ->postParameters = sfToolkit::stripslashesDeep ($ postParameters );
161+ }
162+ else
163+ {
164+ $ this ->postParameters = $ postParameters ;
165+ }
166+
152167 $ this ->parameterHolder ->add ($ this ->postParameters );
153168
154169 if ($ formats = $ this ->getOption ('formats ' ))
@@ -600,7 +615,14 @@ public function getCookie($name, $defaultValue = null)
600615
601616 if (isset ($ _COOKIE [$ name ]))
602617 {
603- $ retval = get_magic_quotes_gpc () ? sfToolkit::stripslashesDeep ($ _COOKIE [$ name ]) : $ _COOKIE [$ name ];
618+ if (version_compare (PHP_VERSION , '5.4 ' , '< ' ) && get_magic_quotes_gpc ())
619+ {
620+ $ retval = sfToolkit::stripslashesDeep ($ _COOKIE [$ name ]);
621+ }
622+ else
623+ {
624+ $ retval = $ _COOKIE [$ name ];
625+ }
604626 }
605627
606628 return $ retval ;
0 commit comments