Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove deprecated items in Request #8617

Merged
merged 5 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions system/HTTP/IncomingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@
*/
class IncomingRequest extends Request
{
/**
* Enable CSRF flag
*
* Enables a CSRF cookie token to be set.
* Set automatically based on Config setting.
*
* @var bool
*
* @deprecated Not used
*/
protected $enableCSRF = false;

/**
* The URI for this request.
*
Expand Down Expand Up @@ -121,13 +109,6 @@ class IncomingRequest extends Request
*/
protected $validLocales = [];

/**
* Configuration settings.
*
* @var App
*/
protected $config;

/**
* Holds the old data from a redirect.
*
Expand Down Expand Up @@ -172,7 +153,6 @@ public function __construct($config, ?URI $uri = null, $body = 'php://input', ?U
$body = null;
}

$this->config = $config;
$this->uri = $uri;
$this->body = $body;
$this->userAgent = $userAgent;
Expand Down Expand Up @@ -929,18 +909,4 @@ public function getFile(string $fileID)

return $this->files->getFile($fileID);
}

/**
* Remove relative directory (../) and multi slashes (///)
*
* Do some final cleaning of the URI and return it, currently only used in static::_parse_request_uri()
*
* @deprecated 4.1.2 Use URI::removeDotSegments() directly
*/
protected function removeRelativeDirectory(string $uri): string
{
$uri = URI::removeDotSegments($uri);

return $uri === '/' ? $uri : ltrim($uri, '/');
}
}
15 changes: 3 additions & 12 deletions system/HTTP/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,15 @@ class Request extends OutgoingRequest implements RequestInterface
{
use RequestTrait;

/**
* Proxy IPs
*
* @var array<string, string>
*
* @deprecated 4.0.5 No longer used. Check the App config directly
*/
protected $proxyIPs;

/**
* Constructor.
*
* @param App $config
*
* @deprecated 4.0.5 The $config is no longer needed and will be removed in a future version
*/
public function __construct($config = null) // @phpstan-ignore-line
public function __construct($config = null)
{
$this->config = $config ?? config(App::class);

if (empty($this->method)) {
$this->method = $this->getServer('REQUEST_METHOD') ?? Method::GET;
}
Expand Down
9 changes: 8 additions & 1 deletion system/HTTP/RequestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
*/
trait RequestTrait
{
/**
* Configuration settings.
*
* @var App
*/
protected $config;

/**
* IP address of the current user.
*
Expand Down Expand Up @@ -61,7 +68,7 @@ public function getIPAddress(): string
'valid_ip',
];

$proxyIPs = config(App::class)->proxyIPs;
$proxyIPs = $this->config->proxyIPs;

if (! empty($proxyIPs) && (! is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) {
throw new ConfigException(
Expand Down
3 changes: 3 additions & 0 deletions user_guide_src/source/changelogs/v4.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ Request
has been removed.
- The visibility of the deprecated properties ``$uri`` and ``$config`` in
``IncomingRequest`` has been changed to protected.
- The ``$enableCSRF`` property in ``IncomingRequest`` has been removed.
- The ``removeRelativeDirectory()`` method in ``IncomingRequest`` has been removed.
- The ``$proxyIPs`` property in ``Request`` has been removed.

Filters
-------
Expand Down
Loading