Permalink
Browse files

Request: removed unused second parameter $query (BC break)

  • Loading branch information...
dg committed Feb 11, 2019
1 parent d0992eb commit 5f829797d0c365753e56b4197ad3295e45811a79
@@ -61,14 +61,10 @@ class Request implements IRequest
private $rawBodyCallback;
public function __construct(UrlScript $url, $query = null, array $post = null, array $files = null, array $cookies = null,
public function __construct(UrlScript $url, array $post = null, array $files = null, array $cookies = null,
array $headers = null, string $method = null, string $remoteAddress = null, string $remoteHost = null, callable $rawBodyCallback = null)
{
$this->url = $url;
if ($query !== null) {
trigger_error('Nette\Http\Request::__construct(): parameter $query is deprecated.', E_USER_DEPRECATED);
$url->setQuery($query);
}
$this->post = (array) $post;
$this->files = (array) $files;
$this->cookies = (array) $cookies;
@@ -71,7 +71,6 @@ public function createHttpRequest(): Request
return new Request(
$url,
null,
$post,
$this->identifyFiles(),
$cookies,
@@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';
test(function () {
$headers = ['Accept-Language' => 'en, cs'];
$request = new Http\Request(new Http\UrlScript, null, null, null, null, $headers);
$request = new Http\Request(new Http\UrlScript, null, null, null, $headers);
Assert::same('en', $request->detectLanguage(['en', 'cs']));
Assert::same('en', $request->detectLanguage(['cs', 'en']));
@@ -25,7 +25,7 @@ test(function () {
test(function () {
$headers = ['Accept-Language' => 'da, en-gb;q=0.8, en;q=0.7'];
$request = new Http\Request(new Http\UrlScript, null, null, null, null, $headers);
$request = new Http\Request(new Http\UrlScript, null, null, null, $headers);
Assert::same('en-gb', $request->detectLanguage(['en', 'en-gb']));
Assert::same('en', $request->detectLanguage(['en']));
@@ -34,15 +34,15 @@ test(function () {
test(function () {
$headers = [];
$request = new Http\Request(new Http\UrlScript, null, null, null, null, $headers);
$request = new Http\Request(new Http\UrlScript, null, null, null, $headers);
Assert::null($request->detectLanguage(['en']));
});
test(function () {
$headers = ['Accept-Language' => 'garbage'];
$request = new Http\Request(new Http\UrlScript, null, null, null, null, $headers);
$request = new Http\Request(new Http\UrlScript, null, null, null, $headers);
Assert::null($request->detectLanguage(['en']));
});
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
test(function () {
$request = new Http\Request(new Http\UrlScript, null, null, null, null, null, null, null, null, function () {
$request = new Http\Request(new Http\UrlScript, null, null, null, null, null, null, null, function () {
return 'raw body';
});
@@ -19,12 +19,12 @@ test(function () {
});
test(function () {
$request = new Http\Request(new Http\UrlScript, null, null, null, null, []);
$request = new Http\Request(new Http\UrlScript, null, null, null, []);
Assert::same([], $request->getHeaders());
});
test(function () {
$request = new Http\Request(new Http\UrlScript, null, null, null, null, [
$request = new Http\Request(new Http\UrlScript, null, null, null, [
'one' => '1',
'TWO' => '2',
'X-Header' => 'X',
@@ -20,7 +20,7 @@ $_COOKIE[$sessionName] = $leet = md5('1337');
$cookies = [$sessionName => $sessionId = md5('1')];
file_put_contents(TEMP_DIR . '/sess_' . $sessionId, sprintf('__NF|a:2:{s:4:"Time";i:%s;s:4:"DATA";a:1:{s:4:"temp";a:1:{s:5:"value";s:3:"yes";}}}', time() - 1000));
$session = new Session(new Http\Request(new Http\UrlScript('http://nette.org'), null, [], [], $cookies), new Http\Response);
$session = new Session(new Http\Request(new Http\UrlScript('http://nette.org'), [], [], $cookies), new Http\Response);
$session->start();
Assert::same($sessionId, $session->getId());
@@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';
$cookies = [session_name() => '#'];
$session = new Http\Session(new Http\Request(new Http\UrlScript, null, [], [], $cookies), new Http\Response);
$session = new Http\Session(new Http\Request(new Http\UrlScript, [], [], $cookies), new Http\Response);
$session->start();
@@ -18,7 +18,7 @@ require __DIR__ . '/../bootstrap.php';
$cookies = [session_name() => $sessionId = md5('3')];
file_put_contents(TEMP_DIR . '/sess_' . $sessionId, '__NF|a:1:{s:4:"DATA";a:1:{s:4:"temp";a:1:{s:5:"value";s:3:"yes";}}}');
$session = new Session(new Http\Request(new Http\UrlScript('http://nette.org'), null, [], [], $cookies), new Http\Response);
$session = new Session(new Http\Request(new Http\UrlScript('http://nette.org'), [], [], $cookies), new Http\Response);
$session->start();
Assert::same('yes', $session->getSection('temp')->value);
@@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';
$cookies = [session_name() => $sessionId = md5('3')];
file_put_contents(TEMP_DIR . '/sess_' . $sessionId, sprintf('__NF|a:2:{s:4:"Time";i:%s;s:4:"DATA";a:1:{s:4:"temp";a:1:{s:5:"value";s:3:"yes";}}}', time() - 1000));
$session = new Http\Session(new Http\Request(new Http\UrlScript, null, [], [], $cookies), new Http\Response);
$session = new Http\Session(new Http\Request(new Http\UrlScript, [], [], $cookies), new Http\Response);
$session->start();
Assert::same($sessionId, $session->getId());

0 comments on commit 5f82979

Please sign in to comment.