Skip to content
Open
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
8 changes: 3 additions & 5 deletions system/HTTP/Exceptions/RedirectException.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
class RedirectException extends RuntimeException implements ExceptionInterface, ResponsableInterface, HTTPExceptionInterface
{
/**
* HTTP status code for redirects
*
* @var int
* Status code applied to a Response that arrives without a 3xx redirect status.
*/
protected $code = 302;
protected int $defaultStatusCode = 302;

protected ?ResponseInterface $response = null;

Expand Down Expand Up @@ -61,7 +59,7 @@ public function __construct($message = '', int $code = 0, ?Throwable $previous =
}

if ($this->response->getStatusCode() < 301 || $this->response->getStatusCode() > 308) {
$this->response->setStatusCode($this->code);
$this->response->setStatusCode($this->defaultStatusCode);
}
}

Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.8.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Behavior Changes
- **Filters:** HTTP method matching for method-based filters is now case-sensitive. The keys in ``Config\Filters::$methods`` must exactly match the request method
(e.g., ``GET``, ``POST``). Lowercase method names (e.g., ``post``) will no longer match.
- **HTTP:** Routes defined with ``$routes->add()`` now also match HTTP ``QUERY`` requests. If the route has CSRF protection, remember that CSRF verification does not protect safe methods such as ``GET`` and ``QUERY``.
- **HTTP:** ``CodeIgniter\HTTP\Exceptions\RedirectException`` no longer redeclares the inherited ``$code`` property. The status applied to a ``Response`` passed to the constructor without a 3xx status now comes from the new ``protected int $defaultStatusCode = 302`` property. Subclasses that overrode ``$code`` to change that status must override ``$defaultStatusCode`` instead.
- **Testing:** Tests using the ``FeatureTestTrait`` must now use uppercase HTTP method names when performing a request when using the ``call()`` method directly
(e.g., ``$this->call('GET', '/path')`` instead of ``$this->call('get', '/path')``). Additionally, setting method-based routes using ``withRoutes()`` must
also use uppercase method names (e.g., ``$this->withRoutes([['GET', 'home', 'Home::index']])``).
Expand Down
2 changes: 1 addition & 1 deletion utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 1492 errors
# total 1491 errors

includes:
- argument.type.neon
Expand Down
7 changes: 1 addition & 6 deletions utils/phpstan-baseline/property.phpDocType.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 41 errors
# total 40 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -137,11 +137,6 @@ parameters:
count: 1
path: ../../system/Exceptions/PageNotFoundException.php

-
message: '#^PHPDoc type int of property CodeIgniter\\HTTP\\Exceptions\\RedirectException\:\:\$code is not the same as PHPDoc type mixed of overridden property Exception\:\:\$code\.$#'
count: 1
path: ../../system/HTTP/Exceptions/RedirectException.php

-
message: '#^PHPDoc type string of property CodeIgniter\\HTTP\\Files\\UploadedFile\:\:\$originalMimeType is not the same as PHPDoc type string\|null of overridden property CodeIgniter\\Files\\File\:\:\$originalMimeType\.$#'
count: 1
Expand Down
Loading