예제 #1
0
 /**
  * @covers Fisharebest\PhpPolyfill\Php54::removeMagicQuotes
  * @runInSeparateProcess
  */
 public function testHttpRemoveMagicQuotes()
 {
     $_GET = array(addslashes('g\\et') => addslashes('G\'ET'));
     $_POST = array(addslashes('p\\ost') => addslashes('P\'OST'));
     $_COOKIE = array(addslashes('c\\ookie') => addslashes('C\'OOKIE'));
     $_REQUEST = array(addslashes('r\\equest') => addslashes('R\'EQUEST'));
     Php54::removeMagicQuotes();
     $this->assertSame(array('g\\et' => 'G\'ET'), $_GET);
     $this->assertSame(array('p\\ost' => 'P\'OST'), $_POST);
     $this->assertSame(array('c\\ookie' => 'C\'OOKIE'), $_COOKIE);
     $this->assertSame(array('r\\equest' => 'R\'EQUEST'), $_REQUEST);
 }
예제 #2
0
        if (!function_exists('gzseek') && function_exists('gzseek64')) {
            function gzseek($zp, $offset, $whence = SEEK_SET)
            {
                return gzseek64($zp, $offset, $whence);
            }
        }
        if (!function_exists('gztell') && function_exists('gztell64')) {
            function gztell($zp)
            {
                return gztell64($zp);
            }
        }
    }
    if (PHP_VERSION_ID < 50400) {
        // Magic quotes were removed in PHP 5.4
        if (get_magic_quotes_gpc()) {
            Php54::removeMagicQuotes();
        }
        // The global session variable bug/feature was removed in PHP 5.4
        if (ini_get('session.bug_compat_42')) {
            ini_set('session.bug_compat_42', '0');
        }
        // Add features that were introduced in PHP 5.4
        if (!function_exists('http_response_code')) {
            function http_response_code($reponse_code = null)
            {
                return Php54::httpResponseCode($reponse_code);
            }
        }
    }
}