Skip to content

Commit 25f7636

Browse files
committed
refactor: remove strtoupper()/strtolower() for $request->getMethod()
1 parent d05a5a6 commit 25f7636

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

app/Views/errors/html/error_exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
</tr>
206206
<tr>
207207
<td>HTTP Method</td>
208-
<td><?= esc(strtoupper($request->getMethod())) ?></td>
208+
<td><?= esc($request->getMethod()) ?></td>
209209
</tr>
210210
<tr>
211211
<td>IP Address</td>

system/Debug/Exceptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function exceptionHandler(Throwable $exception)
128128

129129
if ($this->config->log === true && ! in_array($statusCode, $this->config->ignoreCodes, true)) {
130130
$uri = $this->request->getPath() === '' ? '/' : $this->request->getPath();
131-
$routeInfo = '[Method: ' . strtoupper($this->request->getMethod()) . ', Route: ' . $uri . ']';
131+
$routeInfo = '[Method: ' . $this->request->getMethod() . ', Route: ' . $uri . ']';
132132

133133
log_message('critical', "{message}\n{routeInfo}\nin {exFile} on line {exLine}.\n{trace}", [
134134
'message' => $exception->getMessage(),

system/Debug/Toolbar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function run(float $startTime, float $totalTime, RequestInterface $reques
7979
$data = [];
8080
// Data items used within the view.
8181
$data['url'] = current_url();
82-
$data['method'] = strtoupper($request->getMethod());
82+
$data['method'] = $request->getMethod();
8383
$data['isAJAX'] = $request->isAJAX();
8484
$data['startTime'] = $startTime;
8585
$data['totalTime'] = $totalTime * 1000;

system/Security/Security.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public function getCSRFTokenName(): string
280280
public function verify(RequestInterface $request)
281281
{
282282
// Protects POST, PUT, DELETE, PATCH
283-
$method = strtoupper($request->getMethod());
283+
$method = $request->getMethod();
284284
$methodsToProtect = ['POST', 'PUT', 'DELETE', 'PATCH'];
285285
if (! in_array($method, $methodsToProtect, true)) {
286286
return $this;

system/Validation/Validation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ public function withRequest(RequestInterface $request): ValidationInterface
501501
return $this;
502502
}
503503

504-
if (in_array(strtolower($request->getMethod()), ['put', 'patch', 'delete'], true)
504+
if (in_array($request->getMethod(), ['PUT', 'PATCH', 'DELETE'], true)
505505
&& strpos($request->getHeaderLine('Content-Type'), 'multipart/form-data') === false
506506
) {
507507
$this->data = $request->getRawInput();

tests/system/HTTP/OutgoingRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ public function testWithMethod(): void
4444

4545
$newRequest = $request->withMethod('POST');
4646

47-
$this->assertSame('GET', strtoupper($request->getMethod()));
48-
$this->assertSame('POST', strtoupper($newRequest->getMethod()));
47+
$this->assertSame('GET', $request->getMethod());
48+
$this->assertSame('POST', $newRequest->getMethod());
4949
}
5050

5151
public function testWithUri(): void

0 commit comments

Comments
 (0)