Skip to content

Commit 02a3ff1

Browse files
committed
Merged the changes
2 parents fd69457 + a7c9a2f commit 02a3ff1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+569
-886
lines changed

.github/workflows/test-file-permissions.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@ jobs:
2020
- name: Checkout
2121
uses: actions/checkout@v6
2222

23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.2'
27+
2328
- name: Detect unnecessary execution permissions
2429
run: php utils/check_permission_x.php

.github/workflows/test-userguide.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ jobs:
2626
- name: Checkout
2727
uses: actions/checkout@v6
2828

29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: '8.2'
33+
2934
- name: Setup Python
3035
uses: actions/setup-python@v6
3136
with:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"phpunit/phpcov": "^9.0.2 || ^10.0",
2929
"phpunit/phpunit": "^10.5.16 || ^11.2",
3030
"predis/predis": "^3.0",
31-
"rector/rector": "2.3.6",
31+
"rector/rector": "2.3.7",
3232
"shipmonk/phpstan-baseline-per-identifier": "^2.0"
3333
},
3434
"replace": {

system/BaseModel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ abstract public function countAllResults(bool $reset = true, bool $test = false)
582582
* @return void
583583
*
584584
* @throws DataException
585+
* @throws InvalidArgumentException if $size is not a positive integer
585586
*/
586587
abstract public function chunk(int $size, Closure $userFunc);
587588

system/Config/Services.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ public static function csp(?CSPConfig $config = null, bool $getShared = true)
198198
* The CURL Request class acts as a simple HTTP client for interacting
199199
* with other servers, typically through APIs.
200200
*
201+
* @todo v4.8.0 Remove $config parameter since unused
202+
*
201203
* @return CURLRequest
202204
*/
203205
public static function curlrequest(array $options = [], ?ResponseInterface $response = null, ?App $config = null, bool $getShared = true)
@@ -207,7 +209,7 @@ public static function curlrequest(array $options = [], ?ResponseInterface $resp
207209
}
208210

209211
$config ??= config(App::class);
210-
$response ??= new Response($config);
212+
$response ??= new Response();
211213

212214
return new CURLRequest(
213215
$config,
@@ -576,6 +578,8 @@ public static function incomingrequest(?App $config = null, bool $getShared = tr
576578
/**
577579
* The Response class models an HTTP response.
578580
*
581+
* @todo v4.8.0 Remove $config parameter since unused
582+
*
579583
* @return ResponseInterface
580584
*/
581585
public static function response(?App $config = null, bool $getShared = true)
@@ -584,14 +588,14 @@ public static function response(?App $config = null, bool $getShared = true)
584588
return static::getSharedInstance('response', $config);
585589
}
586590

587-
$config ??= config(App::class);
588-
589-
return new Response($config);
591+
return new Response();
590592
}
591593

592594
/**
593595
* The Redirect class provides nice way of working with redirects.
594596
*
597+
* @todo v4.8.0 Remove $config parameter since unused
598+
*
595599
* @return RedirectResponse
596600
*/
597601
public static function redirectresponse(?App $config = null, bool $getShared = true)
@@ -600,8 +604,7 @@ public static function redirectresponse(?App $config = null, bool $getShared = t
600604
return static::getSharedInstance('redirectresponse', $config);
601605
}
602606

603-
$config ??= config(App::class);
604-
$response = new RedirectResponse($config);
607+
$response = new RedirectResponse();
605608
$response->setProtocolVersion(AppServices::get('request')->getProtocolVersion());
606609

607610
return $response;

system/Database/BaseConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ public function callFunction(string $functionName, ...$params): bool
15241524
{
15251525
$driver = $this->getDriverFunctionPrefix();
15261526

1527-
if (! str_contains($driver, $functionName)) {
1527+
if (! str_starts_with($functionName, $driver)) {
15281528
$functionName = $driver . $functionName;
15291529
}
15301530

system/Database/BasePreparedQuery.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ public function __construct(BaseConnection $db)
8080
*/
8181
public function prepare(string $sql, array $options = [], string $queryClass = Query::class)
8282
{
83-
// We only supports positional placeholders (?)
84-
// in order to work with the execute method below, so we
85-
// need to replace our named placeholders (:name)
86-
$sql = preg_replace('/:[^\s,)]+/', '?', $sql);
83+
// We only support positional placeholders (?), so convert
84+
// named placeholders (:name or :name:) while leaving dialect
85+
// syntax like PostgreSQL casts (::type) untouched.
86+
$sql = preg_replace('/(?<!:):([a-zA-Z_]\w*):?(?!:)/', '?', $sql);
8787

8888
/** @var Query $query */
8989
$query = new $queryClass($this->db);

system/Debug/BaseExceptionHandler.php

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313

1414
namespace CodeIgniter\Debug;
1515

16-
use CodeIgniter\HTTP\CLIRequest;
17-
use CodeIgniter\HTTP\IncomingRequest;
18-
use CodeIgniter\HTTP\RequestInterface;
19-
use CodeIgniter\HTTP\ResponseInterface;
2016
use Config\Exceptions as ExceptionsConfig;
2117
use Throwable;
2218

@@ -53,21 +49,6 @@ public function __construct(ExceptionsConfig $config)
5349
}
5450
}
5551

56-
/**
57-
* The main entry point into the handler.
58-
*
59-
* @param CLIRequest|IncomingRequest $request
60-
*
61-
* @return void
62-
*/
63-
abstract public function handle(
64-
Throwable $exception,
65-
RequestInterface $request,
66-
ResponseInterface $response,
67-
int $statusCode,
68-
int $exitCode,
69-
);
70-
7152
/**
7253
* Gathers the variables that will be made available to the view.
7354
*/
@@ -76,7 +57,7 @@ protected function collectVars(Throwable $exception, int $statusCode): array
7657
// Get the first exception.
7758
$firstException = $exception;
7859

79-
while ($prevException = $firstException->getPrevious()) {
60+
while (($prevException = $firstException->getPrevious()) instanceof Throwable) {
8061
$firstException = $prevException;
8162
}
8263

@@ -103,24 +84,22 @@ protected function collectVars(Throwable $exception, int $statusCode): array
10384
protected function maskSensitiveData(array $trace, array $keysToMask, string $path = ''): array
10485
{
10586
foreach ($trace as $i => $line) {
106-
$trace[$i]['args'] = $this->maskData($line['args'], $keysToMask);
87+
$trace[$i]['args'] = $this->maskData($line['args'], $keysToMask, $path);
10788
}
10889

10990
return $trace;
11091
}
11192

11293
/**
113-
* @param array|object $args
114-
*
115-
* @return array|object
94+
* @param array<int, string> $keysToMask
11695
*/
117-
private function maskData($args, array $keysToMask, string $path = '')
96+
private function maskData(mixed $args, array $keysToMask, string $path = ''): mixed
11897
{
119-
foreach ($keysToMask as $keyToMask) {
120-
$explode = explode('/', $keyToMask);
98+
foreach ($keysToMask as $key) {
99+
$explode = explode('/', $key);
121100
$index = end($explode);
122101

123-
if (str_starts_with(strrev($path . '/' . $index), strrev($keyToMask))) {
102+
if (str_starts_with(strrev($path . '/' . $index), strrev($key))) {
124103
if (is_array($args) && array_key_exists($index, $args)) {
125104
$args[$index] = '******************';
126105
} elseif (

system/Debug/ExceptionHandler.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ public function handle(
9595
$this->respond($data, $statusCode)->send();
9696

9797
if (ENVIRONMENT !== 'testing') {
98-
// @codeCoverageIgnoreStart
99-
exit($exitCode);
100-
// @codeCoverageIgnoreEnd
98+
exit($exitCode); // @codeCoverageIgnore
10199
}
102100

103101
return;
@@ -126,9 +124,7 @@ public function handle(
126124
$this->render($exception, $statusCode, $viewFile);
127125

128126
if (ENVIRONMENT !== 'testing') {
129-
// @codeCoverageIgnoreStart
130-
exit($exitCode);
131-
// @codeCoverageIgnoreEnd
127+
exit($exitCode); // @codeCoverageIgnore
132128
}
133129
}
134130

0 commit comments

Comments
 (0)