Skip to content

Commit 1c093bd

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.8
# Conflicts: # system/HTTP/CLIRequest.php # tests/system/AutoReview/FrameworkCodeTest.php # tests/system/Cache/Handlers/MemcachedHandlerTest.php # tests/system/Cache/Handlers/PredisHandlerTest.php # tests/system/Cache/Handlers/RedisHandlerTest.php # utils/phpstan-baseline/empty.notAllowed.neon # utils/phpstan-baseline/loader.neon
2 parents b1dc98a + 0d1d224 commit 1c093bd

59 files changed

Lines changed: 963 additions & 449 deletions

Some content is hidden

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

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ psalm-baseline.xml export-ignore
3232
psalm.xml export-ignore
3333
psalm_autoload.php export-ignore
3434
rector.php export-ignore
35+
AGENTS.md export-ignore
3536

3637
# source user guide
3738
user_guide_src/ export-ignore

.github/copilot-instructions.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copilot Code Review Instructions
2+
3+
Repository-wide conventions, the target-branch compatibility policy, coding
4+
standards, and FrankenPHP Worker Mode requirements are defined in the root
5+
`AGENTS.md`. Apply that policy in every review; this file covers review
6+
behavior only.
7+
8+
## Review priorities
9+
10+
Prioritize actionable findings involving:
11+
12+
- incorrect behavior or an unhandled edge case;
13+
- backward compatibility;
14+
- security, input validation, and context-appropriate output escaping;
15+
- request-specific state leaking through globals, static properties, or
16+
shared services, including under Worker Mode where one process serves
17+
many requests;
18+
- differences between supported database drivers (MySQLi, PostgreSQL,
19+
SQLite3, SQLSRV, OCI8);
20+
- missing regression tests, user-guide changes, changelog entries, or
21+
upgrade instructions.
22+
23+
## Review behavior
24+
25+
- Determine the PR base branch and apply the compatibility policy from
26+
`AGENTS.md`. If the base branch cannot be determined, assume `develop`
27+
and state that assumption.
28+
- Do not report formatting-only issues already enforced by PHP-CS-Fixer.
29+
- Every finding should identify a concrete failure scenario and the
30+
affected code.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
applyTo: "system/Database/**/*.php,tests/system/Database/**/*.php"
3+
---
4+
5+
# Database layer
6+
7+
- Consider all supported drivers: MySQLi, PostgreSQL, SQLite3, SQLSRV, and
8+
OCI8.
9+
- Check identifier quoting, value binding, `NULL` behavior, transactions,
10+
affected rows, return types, and platform-specific SQL.
11+
- Do not implement driver-independent behavior in only one driver.
12+
- When changing a base database class, inspect driver overrides and their
13+
method signatures.
14+
- Keep driver-independent tests separate from tests that require a live
15+
database.
16+
- Use the `DatabaseLive` PHPUnit group only when a real database connection is
17+
required.
18+
- Prefer focused tests for the affected base class and drivers. Leave the full
19+
multi-driver matrix to GitHub Actions.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
applyTo: "system/**/*.php"
3+
---
4+
5+
# Framework core
6+
7+
- Assume public and protected symbols are extension points used by third-party
8+
applications unless they are clearly marked internal.
9+
- Apply the target-branch compatibility policy from the root `AGENTS.md`
10+
before changing any extension point.
11+
- Before changing a signature or behavior, inspect parent classes, implemented
12+
interfaces, traits, service factories, configuration, and corresponding
13+
tests.
14+
- Keep file paths, class names, and namespaces aligned under `CodeIgniter\`.
15+
- Preserve existing extension and dependency-injection points.
16+
- Consider long-running worker environments. Do not retain request-specific
17+
state in static properties, globals, or shared services after a request
18+
finishes.
19+
- Avoid introducing a framework-wide abstraction to solve a single local
20+
problem.
21+
- On `develop`, keep exceptions and observable side effects compatible. On a
22+
`4.*` target, change them only as an explicit, narrow, documented breaking
23+
enhancement with a migration path.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
applyTo: "tests/**/*.php"
3+
---
4+
5+
# PHPUnit tests
6+
7+
- Mirror the corresponding `system/` component and local test conventions
8+
where practical.
9+
- Add the appropriate PHPUnit `Group` attribute described in
10+
`tests/README.md`.
11+
- Prefer `assertSame()` and dedicated assertions over loose or generic
12+
assertions.
13+
- Cover the regression or behavior through a public API where possible.
14+
Avoid testing private implementation details.
15+
- Restore services, factories, environment variables, superglobals, handlers,
16+
locale, time-related state, and other global state modified by a test.
17+
- Tests must not depend on execution order or state left by another test.
18+
- Do not replace a meaningful assertion with a weaker assertion to make a test
19+
pass.
20+
- After changing behavior, run the smallest relevant test file or component.
21+
Do not run the complete test suite by default.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
applyTo: "user_guide_src/**/*.rst"
3+
---
4+
5+
# User guide
6+
7+
- Preserve the existing reStructuredText structure, terminology, directives,
8+
anchors, and surrounding writing style.
9+
- Keep PHP examples compatible with PHP 8.2 and verify signatures and behavior
10+
against the current framework code.
11+
- Distinguish new behavior from existing behavior and document defaults
12+
precisely.
13+
- Determine the PR target branch before describing compatibility:
14+
`develop` follows the patch-release policy, while `4.*` follows the
15+
minor-release policy in the root `AGENTS.md`.
16+
- Behavior changes, enhancements, deprecations, and important bug fixes may
17+
require a changelog entry.
18+
- Changes requiring users to modify code or configuration may require an
19+
upgrading-guide entry.
20+
- For an intentional compatibility break targeting `4.*`, document the old
21+
behavior, new behavior, affected users, reason for the change, and the
22+
smallest migration in both the minor changelog and upgrading guide.
23+
- Keep code examples minimal but complete enough to run in a normal
24+
CodeIgniter application.
25+
- Leave the complete Sphinx build and documentation validation to GitHub
26+
Actions unless the task specifically requires local documentation
27+
validation.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
applyTo: "system/Boot.php,system/CodeIgniter.php,system/Commands/Worker/**,system/Config/BaseService.php,system/Config/Factories.php,system/Config/Factory.php,system/Config/Services.php,system/Database/Config.php,system/Database/BaseConnection.php,system/Database/ConnectionInterface.php,system/Database/*/Connection.php,system/Events/Events.php,system/Session/**,system/Cache/**,system/HTTP/**,system/Filters/**,system/Router/**,system/Security/**,system/Debug/Toolbar.php,system/Debug/Toolbar/**,app/Config/WorkerMode.php,tests/system/Commands/Worker/**,user_guide_src/source/installation/worker_mode.rst"
3+
---
4+
5+
# FrankenPHP Worker Mode
6+
7+
Use `system/Commands/Worker/Views/frankenphp-worker.php.tpl` as the canonical
8+
Worker Mode entry point. `worker:install` publishes this template to
9+
`public/frankenphp-worker.php`.
10+
11+
When changing bootstrap or request-lifecycle code, trace all three Worker Mode
12+
phases:
13+
14+
1. One-time process bootstrap through `Boot::bootWorker()`.
15+
2. Per-request preparation: reconnect database and cache connections, reset
16+
the `CodeIgniter` instance, and replace all request superglobals before
17+
calling `$app->run()`.
18+
3. Post-request cleanup: close the session, clean up unfinished database
19+
transactions, reset factories and non-persistent services, clean up event
20+
listeners and performance logs, and reset the debug toolbar.
21+
22+
- Preserve the phase ordering unless the change explicitly proves a different
23+
order is safe.
24+
- Check every new mutable static property, singleton, shared service, event
25+
listener, connection, handler, or global for cross-request state leakage.
26+
- Do not preserve a service across requests merely for performance. Persistent
27+
services must be safe to reuse and must not retain request, response, user,
28+
route, security token, locale, or error state.
29+
- Ensure exceptions and early exits cannot skip cleanup needed before the next
30+
request.
31+
- For state-isolation fixes, prefer a regression test that exercises two
32+
sequential requests or reset cycles in the same process and proves the
33+
second request cannot observe the first request's state.
34+
- If the template contract changes, update focused assertions in
35+
`tests/system/Commands/Worker/WorkerCommandsTest.php`.
36+
- If existing installations need the new generated entry point, update the
37+
changelog and upgrading guide and instruct users to run
38+
`php spark worker:install --force`.

.github/scripts/random-tests-config.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
API
1212
AutoReview
1313
Autoloader
14-
# Cache
14+
Cache
1515
CLI
1616
Commands
1717
Config
@@ -20,7 +20,7 @@ Cookie
2020
# DataConverter
2121
# Database
2222
# Debug
23-
# Email
23+
Email
2424
# Encryption
2525
# Entity
2626
Events

.github/workflows/deploy-apidocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ jobs:
3030
git config --global user.name "${GITHUB_ACTOR}"
3131
3232
- name: Checkout source
33-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
33+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3434
with:
3535
path: source
3636
persist-credentials: false
3737

3838
- name: Checkout target
39-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
39+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4040
with:
4141
repository: codeigniter4/api
4242
token: ${{ secrets.ACCESS_TOKEN }}

.github/workflows/deploy-distributables.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
19+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2020
with:
2121
fetch-depth: 0 # fetch all tags
2222
persist-credentials: false
@@ -50,13 +50,13 @@ jobs:
5050
git config --global user.name "${GITHUB_ACTOR}"
5151
5252
- name: Checkout source
53-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
53+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5454
with:
5555
path: source
5656
persist-credentials: false
5757

5858
- name: Checkout target
59-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
59+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6060
with:
6161
repository: codeigniter4/framework
6262
token: ${{ secrets.ACCESS_TOKEN }}
@@ -104,13 +104,13 @@ jobs:
104104
git config --global user.name "${GITHUB_ACTOR}"
105105
106106
- name: Checkout source
107-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
107+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
108108
with:
109109
path: source
110110
persist-credentials: false
111111

112112
- name: Checkout target
113-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
113+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
114114
with:
115115
repository: codeigniter4/appstarter
116116
token: ${{ secrets.ACCESS_TOKEN }}
@@ -158,21 +158,21 @@ jobs:
158158
git config --global user.name "${GITHUB_ACTOR}"
159159
160160
- name: Checkout source
161-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
161+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
162162
with:
163163
path: source
164164
persist-credentials: false
165165

166166
- name: Checkout target
167-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
167+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
168168
with:
169169
repository: codeigniter4/userguide
170170
token: ${{ secrets.ACCESS_TOKEN }}
171171
path: userguide
172172
persist-credentials: false
173173

174174
- name: Setup Python
175-
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
175+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
176176
with:
177177
python-version: '3.12'
178178

0 commit comments

Comments
 (0)