예제 #1
0
 /**
  * Constructor.
  *
  * @param array $get                  The $_GET array
  * @param array $post                 The $_POST array
  * @param array $cookie               The $_COOKIE array
  * @param array $server               The $_SERVER array
  * @param array $env                  The $_ENV array
  * @param array $files                The $_FILES array
  * @param bool  $magicQuotesEnabled   If TRUE, the get, post, cookie arrays will be recursively stripped of slashes.
  */
 public function __construct(array $get, array $post, array $cookie, array $server, array $env, array $files, $magicQuotesEnabled = null)
 {
     if (is_null($magicQuotesEnabled)) {
         $magicQuotesEnabled = \get_magic_quotes_gpc();
     }
     if ($magicQuotesEnabled) {
         $get = TextHelper::stripSlashes($get);
         $post = TextHelper::stripSlashes($post);
         $cookie = TextHelper::stripSlashes($cookie);
     }
     $this->getParams = $get;
     $this->postParams = $post;
     $this->cookies = $cookie;
     $this->server = $server;
     $this->env = $env;
     $this->files = $files;
     list($this->targetUri) = explode('?', $this->server['REQUEST_URI'], 2);
 }
예제 #2
0
 /**
  * Tests the stripSlashes() method.
  *
  * @return void
  */
 public function testStripSlashes()
 {
     $source = array('var1' => 'test\\\\"var', 'var2' => array('var2-1' => 'test\\\\var', 'var2-2' => '\\\''));
     $target = array('var1' => 'test\\"var', 'var2' => array('var2-1' => 'test\\var', 'var2-2' => '\''));
     $this->assertEquals($target, TextHelper::stripSlashes($source));
 }