From 132226550a181899852326e7479e2f27c6aea7b8 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 11 Mar 2024 16:46:25 +0900 Subject: [PATCH 1/5] refactor: remove deprecated Request::$proxyIPs --- system/HTTP/Request.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/system/HTTP/Request.php b/system/HTTP/Request.php index 007b0fcc56c9..28c9a8878aac 100644 --- a/system/HTTP/Request.php +++ b/system/HTTP/Request.php @@ -24,15 +24,6 @@ class Request extends OutgoingRequest implements RequestInterface { use RequestTrait; - /** - * Proxy IPs - * - * @var array - * - * @deprecated 4.0.5 No longer used. Check the App config directly - */ - protected $proxyIPs; - /** * Constructor. * From e4a7e79f09d080ec2dd0deb18a055910dd4272b6 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 11 Mar 2024 16:47:12 +0900 Subject: [PATCH 2/5] refactor: move IncomingRequest::$config to RequestTrait::$config --- system/HTTP/IncomingRequest.php | 8 -------- system/HTTP/Request.php | 6 +++--- system/HTTP/RequestTrait.php | 9 ++++++++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php index 40da9056b963..b826f9b4ae1d 100755 --- a/system/HTTP/IncomingRequest.php +++ b/system/HTTP/IncomingRequest.php @@ -121,13 +121,6 @@ class IncomingRequest extends Request */ protected $validLocales = []; - /** - * Configuration settings. - * - * @var App - */ - protected $config; - /** * Holds the old data from a redirect. * @@ -172,7 +165,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; diff --git a/system/HTTP/Request.php b/system/HTTP/Request.php index 28c9a8878aac..125646b6c7c7 100644 --- a/system/HTTP/Request.php +++ b/system/HTTP/Request.php @@ -28,11 +28,11 @@ class Request extends OutgoingRequest implements RequestInterface * 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; } diff --git a/system/HTTP/RequestTrait.php b/system/HTTP/RequestTrait.php index ca3d0e550945..3f935ea6ab4c 100644 --- a/system/HTTP/RequestTrait.php +++ b/system/HTTP/RequestTrait.php @@ -27,6 +27,13 @@ */ trait RequestTrait { + /** + * Configuration settings. + * + * @var App + */ + protected $config; + /** * IP address of the current user. * @@ -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( From 35a2ec4b8f687bcca47e44d6c230d8d6d6687e91 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 11 Mar 2024 16:50:43 +0900 Subject: [PATCH 3/5] refactor: remove deprecated IncomingRequest::$enableCSRF --- system/HTTP/IncomingRequest.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php index b826f9b4ae1d..ea0bc3c847d5 100755 --- a/system/HTTP/IncomingRequest.php +++ b/system/HTTP/IncomingRequest.php @@ -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. * From 5ef64a0f5b988b15504362124e6443615df0b8b5 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 11 Mar 2024 16:59:28 +0900 Subject: [PATCH 4/5] refactor: remove deprecated IncomingRequest::removeRelativeDirectory() --- system/HTTP/IncomingRequest.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php index ea0bc3c847d5..20f3804fb713 100755 --- a/system/HTTP/IncomingRequest.php +++ b/system/HTTP/IncomingRequest.php @@ -909,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, '/'); - } } From 6683b65bd8647cd4d57b845666bd384e57f20e93 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 11 Mar 2024 17:30:00 +0900 Subject: [PATCH 5/5] docs: add changelog --- user_guide_src/source/changelogs/v4.5.0.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_guide_src/source/changelogs/v4.5.0.rst b/user_guide_src/source/changelogs/v4.5.0.rst index 11c5a755c0ad..f0b24389f329 100644 --- a/user_guide_src/source/changelogs/v4.5.0.rst +++ b/user_guide_src/source/changelogs/v4.5.0.rst @@ -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 -------