repo stringlengths 5 53 | pr_number int32 1 321k | task_type stringclasses 2
values | issue_text stringlengths 0 81.2k | pr_title stringlengths 1 319 | pr_body stringlengths 0 105k | base_sha stringlengths 40 40 | head_sha stringlengths 40 40 | gold_diff stringlengths 0 202M | changed_files listlengths 0 100 | review_threads listlengths 0 100 | test_patch stringlengths 0 23.4M | merged bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
tursodatabase/turso | 7,458 | issue_to_patch | Step result yield | Introduce proper StepResult::Yield so caller can recognize suspension from IO lock. | f522fc66f94c0182b0617462a929da05389331b4 | 5fa6c14c79618f33ae3cec5240593b4e52f9eaa0 | diff --git a/.claude/skills/yield-injections/SKILL.md b/.claude/skills/yield-injections/SKILL.md
index 54d8e9b5cca..96a2db59b49 100644
--- a/.claude/skills/yield-injections/SKILL.md
+++ b/.claude/skills/yield-injections/SKILL.md
@@ -41,7 +41,7 @@ Each yield-capable live object has:
There is no `inject_io_failure!` t... | [
".claude/skills/yield-injections/SKILL.md",
"bindings/javascript/src/lib.rs",
"core/benches/benchmark.rs",
"core/benches/create_index_benchmark.rs",
"core/benches/fts_benchmark.rs",
"core/benches/graph_queries_benchmark.rs",
"core/benches/json_benchmark.rs",
"core/benches/struct_union_benchmark.rs",
... | [] | diff --git a/tests/integration/mvcc.rs b/tests/integration/mvcc.rs
index 2f53d2b40de..8b5e0f48f7c 100644
--- a/tests/integration/mvcc.rs
+++ b/tests/integration/mvcc.rs
@@ -237,7 +237,7 @@ fn test_newrowid_mvcc_concurrent(tmp_db: TempDatabase) -> anyhow::Result<()> {
'retry: loop {
... | true | |
tursodatabase/turso | 7,444 | issue_to_patch | core/mvcc: Shrink version chains and remove empty slots at checkpoint | ## Description
This PR improves MVCC garbage collection efficiency by:
1. **Shrinking version chain allocations after GC**: When `retain()`/`clear()` trim version chains, the underlying Vec keeps its full allocation. This change releases excess capacity down to a quarter of the previous value when survivors occupy le... | e773cdd5b743130d80a112c09f7018c1c55ffa09 | 76fa9b6bcc8e07a5bb967c921681452803f712a3 | diff --git a/core/mvcc/database/checkpoint_state_machine.rs b/core/mvcc/database/checkpoint_state_machine.rs
index d06857f245..bb640ca50d 100644
--- a/core/mvcc/database/checkpoint_state_machine.rs
+++ b/core/mvcc/database/checkpoint_state_machine.rs
@@ -2244,7 +2244,16 @@ impl<Clock: LogicalClock> CheckpointStateMachi... | [
"core/mvcc/database/checkpoint_state_machine.rs",
"core/mvcc/database/mod.rs",
"core/mvcc/database/tests.rs"
] | [
{
"comment": "this will also require holding blocking checkpoint lock right? should we assert that here",
"path": "core/mvcc/database/mod.rs",
"hunk": "@@ -6168,7 +6226,9 @@ impl<Clock: LogicalClock> MvStore<Clock> {\n /// write to the same key.\n pub fn purge_row_versions_during_checkpoint(&sel... | true | ||
tursodatabase/turso | 7,432 | issue_to_patch | core/translate: Fix partial index predicate consumption | Fixes the behavior described in #7410 - partial index WHERE terms were being redundantly evaluated for each row, even though every row in the index already satisfies the predicate by definition.
One stupid edge case to call out: in SQLite, `SELECT count(*) FROM tbl INDEXED BY some_tbl_partial_index` still returns th... | 3285d43110a77d25a27cdfe034a79b902855536e | ab18098dac8fa130b612f7d50b090cb78ae42391 | diff --git a/core/translate/optimizer/access_method.rs b/core/translate/optimizer/access_method.rs
index 5586c306099..0f7f61a7b50 100644
--- a/core/translate/optimizer/access_method.rs
+++ b/core/translate/optimizer/access_method.rs
@@ -11,8 +11,9 @@ use crate::stats::AnalyzeStats;
use crate::translate::collate::Colla... | [
"core/translate/optimizer/access_method.rs",
"core/translate/optimizer/constraints.rs",
"core/translate/optimizer/mod.rs",
"core/translate/optimizer/multi_index.rs",
"core/translate/planner.rs",
"testing/sqltests/tests/partial_idx.sqltest",
"testing/sqltests/tests/snapshot_tests/aggregation/aggregation.... | [] | diff --git a/testing/sqltests/tests/partial_idx.sqltest b/testing/sqltests/tests/partial_idx.sqltest
index 089db4a3c59..9651d848bfa 100644
--- a/testing/sqltests/tests/partial_idx.sqltest
+++ b/testing/sqltests/tests/partial_idx.sqltest
@@ -801,6 +801,35 @@ expect {
hundred
}
+setup partial_index_indexed_by_bet... | true | |
tursodatabase/turso | 7,456 | issue_to_patch | logs: lower level for spam INFO logs | lower few spammy info logs | d49a5584ebd3c5bade9fcafab114f8217b590621 | 0771a1187194dbfbcff349611ec1a1b8a955282a | diff --git a/core/connection.rs b/core/connection.rs
index c43a433785..633bf68441 100644
--- a/core/connection.rs
+++ b/core/connection.rs
@@ -886,7 +886,7 @@ impl Connection {
self.prepare_with_origin(sql, StatementOrigin::InternalHelper)
}
- #[instrument(skip_all, level = Level::INFO)]
+ #[instr... | [
"core/connection.rs",
"core/mvcc/database/mod.rs"
] | [] | true | ||
tursodatabase/turso | 7,450 | issue_to_patch | core/skiplist: re-vendor crossbeam-skiplist from upstream main | Replaces the vendored crossbeam-skiplist 0.1.3 sources in `core/skiplist` with a fresh copy from the crossbeam repo `main` branch, commit [`05f9478b`](https://github.com/crossbeam-rs/crossbeam/commit/05f9478b333ead58c0bf8e5a37d9ef9bd3b5bf17).
## Memory leak fixed by this re-vendor
The released 0.1.3 (what we had vend... | e773cdd5b743130d80a112c09f7018c1c55ffa09 | 5b49e094c5c19ef32d402a2547bb8b349a427874 | diff --git a/core/skiplist/alloc_helper.rs b/core/skiplist/alloc_helper.rs
new file mode 100644
index 0000000000..ff3507fcf8
--- /dev/null
+++ b/core/skiplist/alloc_helper.rs
@@ -0,0 +1,85 @@
+use core::{alloc::Layout, ptr::NonNull};
+
+// Based on unstable alloc::alloc::Global.
+//
+// Note: unlike alloc::alloc::Globa... | [
"core/skiplist/alloc_helper.rs",
"core/skiplist/base.rs",
"core/skiplist/base_tests.rs",
"core/skiplist/comparator.rs",
"core/skiplist/equivalent.rs",
"core/skiplist/map.rs",
"core/skiplist/map_tests.rs",
"core/skiplist/mod.rs",
"core/skiplist/set.rs",
"core/skiplist/set_tests.rs"
] | [] | true | ||
tursodatabase/turso | 7,428 | issue_to_patch | core: vendor crossbeam-skiplist 0.1.3 as core/skiplist module | Vendors the skiplist implementation from crossbeam-skiplist 0.1.3 (checksum-verified against the published crates.io tarball) directly into `turso_core` as `core/skiplist`, replacing the registry dependency. Used by `core/mvcc`. The upstream integration tests come along as unit test modules; `crossbeam-epoch`/`crossbea... | 9edf2de154be8f0e9033307136056072f9d4f039 | 5d6e45e4b54c283a2408af3dfe83dbd8636c53f3 | diff --git a/Cargo.lock b/Cargo.lock
index 40f68b464e8..28e33833399 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1310,16 +1310,6 @@ dependencies = [
"crossbeam-utils",
]
-[[package]]
-name = "crossbeam-skiplist"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df29d... | [
"Cargo.lock",
"NOTICE.md",
"core/Cargo.toml",
"core/lib.rs",
"core/mvcc/cursor.rs",
"core/mvcc/database/mod.rs",
"core/skiplist/base.rs",
"core/skiplist/base_tests.rs",
"core/skiplist/map.rs",
"core/skiplist/map_tests.rs",
"core/skiplist/mod.rs",
"core/skiplist/set.rs",
"core/skiplist/set_te... | [] | true | ||
tursodatabase/turso | 7,436 | issue_to_patch | build(deps-dev): bump shell-quote from 1.8.3 to 1.8.4 in /bindings/react-native | Bumps [shell-quote](https://github.com/ljharb/shell-quote) from 1.8.3 to 1.8.4.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/ljharb/shell-quote/blob/main/CHANGELOG.md">shell-quote's changelog</a>.</em></p>
<blockquote>
<h2><a href="https://github.com/ljharb/shell-quote/compare/... | 3285d43110a77d25a27cdfe034a79b902855536e | b943512c2a9a057308cce5a26cbebbfbbf1c24a3 | diff --git a/bindings/react-native/package-lock.json b/bindings/react-native/package-lock.json
index 2c02e08028..a26c71d982 100644
--- a/bindings/react-native/package-lock.json
+++ b/bindings/react-native/package-lock.json
@@ -8886,9 +8886,9 @@
}
},
"node_modules/shell-quote": {
- "version": "1.8.... | [
"bindings/react-native/package-lock.json"
] | [] | true | ||
tursodatabase/turso | 7,415 | issue_to_patch | perf/connection: regenerate stale limbo lockfile to drop git2 | turso_core no longer depends on the built crate, but the nested limbo benchmark workspace still pinned built (and its git2 and libgit2-sys transitive deps) in its lockfile. Regenerate it to match the current dependency graph. | dd4b4d9107828ae2f3b56a374043ae84c76bd3f1 | 9763fed9fd5e18ea850e94f2a918b06372df1ffc | diff --git a/perf/connection/limbo/Cargo.lock b/perf/connection/limbo/Cargo.lock
index efbf87e950b..bcf9be69cd7 100644
--- a/perf/connection/limbo/Cargo.lock
+++ b/perf/connection/limbo/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+... | [
"perf/connection/limbo/Cargo.lock"
] | [] | true | ||
tursodatabase/turso | 7,417 | issue_to_patch | build(deps-dev): bump @babel/plugin-transform-modules-systemjs from 7.29.0 to 7.29.7 in /bindings/react-native | Bumps [@babel/plugin-transform-modules-systemjs](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-modules-systemjs) from 7.29.0 to 7.29.7.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/babel/babel/releases">@babel/plugin-transform-modules-systemjs's ... | dd4b4d9107828ae2f3b56a374043ae84c76bd3f1 | cac617b203d57c6b8c9788efea8929a570a033de | diff --git a/bindings/react-native/package-lock.json b/bindings/react-native/package-lock.json
index d512c86208..2c02e08028 100644
--- a/bindings/react-native/package-lock.json
+++ b/bindings/react-native/package-lock.json
@@ -29,13 +29,13 @@
}
},
"node_modules/@babel/code-frame": {
- "version": "... | [
"bindings/react-native/package-lock.json"
] | [] | true | ||
tursodatabase/turso | 7,427 | issue_to_patch | core/mvcc: checkpoint must use the schema of the database it operates on | ## Summary
- `PRAGMA aux.wal_checkpoint(TRUNCATE)` against an attached MVCC database panics with `checkpoint index struct missing before BTreeCreateIndex` whenever the attached DB's schema diverges from main's. Root cause: `CheckpointStateMachine::new` always pulled `connection.db.clone_schema()` (the main DB's), so `... | fc549278585042f4f07505cca8e5a39c35e57334 | ef0474cece64727f1f68baed665936f538a9f5a0 | diff --git a/core/connection.rs b/core/connection.rs
index 77c63a4032..c43a433785 100644
--- a/core/connection.rs
+++ b/core/connection.rs
@@ -1988,6 +1988,7 @@ impl Connection {
self.clone(),
true,
self.get_sync_mode(),
+ MAIN_DB_ID,
);
... | [
"core/connection.rs",
"core/mvcc/database/checkpoint_state_machine.rs",
"core/mvcc/database/mod.rs",
"core/mvcc/database/tests.rs",
"core/vdbe/execute.rs",
"tests/integration/mvcc.rs"
] | [] | diff --git a/tests/integration/mvcc.rs b/tests/integration/mvcc.rs
index 05c4057db2..2f53d2b40d 100644
--- a/tests/integration/mvcc.rs
+++ b/tests/integration/mvcc.rs
@@ -557,6 +557,56 @@ fn test_drop_cleans_up_mvcc_transactions(tmp_db: TempDatabase) -> anyhow::Result
Ok(())
}
+/// `PRAGMA aux.wal_checkpoint(TR... | true | |
tursodatabase/turso | 7,349 | issue_to_patch | Remove blocking IO from mvcc bootstrap and recovery paths | ## Lift blocking IO part 2: schema reparse + MVCC bootstrap/recovery
Removes synchronous `io.block`/`wait_for_completion` from the MVCC open path so it no longer hangs on backends without a synchronous IO pump (e.g. WASM, where `io.step()` is a no-op). The whole bootstrap → checkpoint-reconcile → schema
reparse → m... | 8231c6dfff4cd47f6c68da643c7ba336b8a14c19 | 3622d24a1de2101b2d1b434b663c049d2174ee79 | diff --git a/core/connection.rs b/core/connection.rs
index cf3266e6b5..77c63a4032 100644
--- a/core/connection.rs
+++ b/core/connection.rs
@@ -19,9 +19,9 @@ use crate::{
ast, function,
io::{MemoryIO, IO},
progress::{ProgressHandler, ProgressHandlerCallback},
- refresh_analyze_stats, translate,
+ tr... | [
"core/connection.rs",
"core/lib.rs",
"core/mvcc/database/mod.rs",
"core/mvcc/database/tests.rs",
"core/mvcc/persistent_storage/logical_log.rs",
"core/statement.rs",
"core/stats.rs",
"core/util.rs"
] | [
{
"comment": "~~note to self: looks to be that this function is not safely re-entrant~~\r\n\r\nit was re-entrant it was just stupid because it re-parsed the whole frame if any frame yielded mid-way, so a real state machine was added",
"path": "core/mvcc/persistent_storage/logical_log.rs",
"hunk": "@@ -2... | true | ||
tursodatabase/turso | 7,377 | issue_to_patch | add yielding IO back-end for turso-stress to test async re-entrancy | Introduces a new IO back-end which otherwise acts like MemoryIO, but yields on each call to force functions to be safely re-entrant. Will be used for turso-stress in Antithesis
| 466a5f5eae1245f2f261771d0e6bfa709ca5ea24 | 34e0222dd408971a6ee2ca57854aa40927afda0b | diff --git a/Dockerfile.antithesis b/Dockerfile.antithesis
index 69db5004c3..00a6ca6005 100644
--- a/Dockerfile.antithesis
+++ b/Dockerfile.antithesis
@@ -78,6 +78,7 @@ WORKDIR /app
COPY ./testing/antithesis/bank-test/*.py /opt/antithesis/test/v1/bank-test/
COPY ./testing/antithesis/stress-composer/*.py /opt/antithes... | [
"Dockerfile.antithesis",
"bindings/rust/Cargo.toml",
"core/Cargo.toml",
"core/ext/mod.rs",
"core/io/memory.rs",
"core/io/memory_yield.rs",
"core/io/mod.rs",
"core/lib.rs",
"core/storage/pager.rs",
"testing/antithesis/stress-memory_yield/singleton_driver_stress.sh",
"testing/stress/Cargo.toml",
... | [] | true | ||
tursodatabase/turso | 7,424 | issue_to_patch | lock cargo-fuzz to 0.13.0 to prevent CI failure | causes: https://github.com/tursodatabase/turso/actions/runs/27227979449/job/80400190373?pr=7423
| dd4b4d9107828ae2f3b56a374043ae84c76bd3f1 | 4b09d34fc7b917b37e249b416a9bb43269b03867 | diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml
index 4a75cbb5f9e..28da4c7d601 100644
--- a/.github/workflows/fuzz.yml
+++ b/.github/workflows/fuzz.yml
@@ -139,6 +139,6 @@ jobs:
prefix-key: "v1-rust-fuzz"
cache-on-failure: true
- name: Install cargo-fuzz
- run: cargo ins... | [
".github/workflows/fuzz.yml"
] | [] | true | ||
tursodatabase/turso | 7,413 | issue_to_patch | core/mvcc: properly complete checkpoint in case of error | Call `self.mvstore.storage.on_checkpoint_end` in the `cleanup_after_external_io_error` to properly cleanup checkpoint in cased of IO error | c70a032dc805280d77819423caddc959d66617c7 | 44e50d002bb285a154224834de2069b8da510394 | diff --git a/core/connection.rs b/core/connection.rs
index 9a1d0b9df6..cf3266e6b5 100644
--- a/core/connection.rs
+++ b/core/connection.rs
@@ -1721,7 +1721,7 @@ impl Connection {
Ok(TransitionResult::Done(result)) => return Ok(result),
Ok(TransitionResult::Io(iocompletions)) =>... | [
"core/connection.rs",
"core/mvcc/database/checkpoint_state_machine.rs",
"core/mvcc/database/mod.rs",
"core/mvcc/database/tests.rs",
"core/storage/pager.rs",
"core/vdbe/execute.rs"
] | [] | true | ||
tursodatabase/turso | 7,407 | issue_to_patch | build(deps): bump ws from 8.20.0 to 8.21.0 in /testing/conformance/javascript | Bumps [ws](https://github.com/websockets/ws) from 8.20.0 to 8.21.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/websockets/ws/releases">ws's releases</a>.</em></p>
<blockquote>
<h2>8.21.0</h2>
<h1>Features</h1>
<ul>
<li>Introduced the <code>maxBufferedChunks</code> and <co... | c54ea4f245348aa963deef5c095186640e47a700 | 72c576ce3442c3152940d2c999e6d1fa83308116 | diff --git a/testing/conformance/javascript/package-lock.json b/testing/conformance/javascript/package-lock.json
index c6e66a3c212..1d9cbe0a897 100644
--- a/testing/conformance/javascript/package-lock.json
+++ b/testing/conformance/javascript/package-lock.json
@@ -18,10 +18,10 @@
},
"../../../bindings/javascr... | [
"testing/conformance/javascript/package-lock.json"
] | [] | true | ||
tursodatabase/turso | 7,412 | issue_to_patch | python: enable Tantivy FTS and add tests | The `fts` cargo feature (which pulls in tantivy) propagated from `core` to `sdk-kit` but stopped there: `py-turso` depended on `turso_sdk_kit` without enabling `fts`, so `CREATE INDEX ... USING fts` failed at runtime even with the `index_method` experimental flag set.
Enable `turso_sdk_kit/fts` in the Python binding... | c70a032dc805280d77819423caddc959d66617c7 | 8a625a8470430619d400e04aaabb954885188d85 | diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml
index 06aa2fa0970..2da4b5349cf 100644
--- a/bindings/python/Cargo.toml
+++ b/bindings/python/Cargo.toml
@@ -16,7 +16,7 @@ crate-type = ["cdylib"]
[dependencies]
anyhow = "1.0"
-turso_sdk_kit = { workspace = true }
+turso_sdk_kit = { workspace = tr... | [
"bindings/python/Cargo.toml",
"bindings/python/tests/test_database.py"
] | [] | diff --git a/bindings/python/tests/test_database.py b/bindings/python/tests/test_database.py
index 2b84eade3e8..13b341857aa 100644
--- a/bindings/python/tests/test_database.py
+++ b/bindings/python/tests/test_database.py
@@ -1709,3 +1709,50 @@ def test_named_params_missing_indexed_qmark_currently_allowed_difference(pro... | true | |
tursodatabase/turso | 7,137 | issue_to_patch | mvcc fix AUTOINCRMENT
The problem is the default behaviour in SQLite/Turso is to use a table called sqlite_sequence which store that max rowid so that AUTOINCREMENT will +1that one to allocate new rowid. This means every INSERT will update that entry in that table, which means in concurrent writes, we will always caus... | feat: add PostgreSQL-style sequences and MVCC-safe AUTOINCREMENT | Add CREATE SEQUENCE / DROP SEQUENCE / nextval() / setval() / currval() as first-class schema objects, and reimplement AUTOINCREMENT on top of the same infrastructure so it works correctly under MVCC.
Sequences are the standard mechanism for generating monotonically increasing (or decreasing) identifiers. This commit a... | 7715979bd0d3118c3f44614cba11847693cd3ea6 | 20b7c23c7fa261ca91d2e642c331f06eeb68d30c | diff --git a/core/connection.rs b/core/connection.rs
index ce01a7f1322..9a1d0b9df64 100644
--- a/core/connection.rs
+++ b/core/connection.rs
@@ -18,11 +18,10 @@ use crate::Page;
use crate::{
ast, function,
io::{MemoryIO, IO},
- parse_schema_rows,
progress::{ProgressHandler, ProgressHandlerCallback},
... | [
"bindings/rust/tests/integration_tests.rs",
"core/connection.rs",
"core/error.rs",
"core/function.rs",
"core/lib.rs",
"core/multiprocess_tests.rs",
"core/mvcc/database/checkpoint_state_machine.rs",
"core/mvcc/database/mod.rs",
"core/mvcc/database/tests.rs",
"core/mvcc/persistent_storage/logical_lo... | [
{
"comment": "We *really* need to avoid doing this synchronously. I have a local branch where I am working on trying to remove `io.wait_for_completion()` and `io.block()` from the IO trait entirely, because this hangs on platforms like WASM where the completions must be driven by the external runtime and it mak... | diff --git a/bindings/rust/tests/integration_tests.rs b/bindings/rust/tests/integration_tests.rs
index 7cb59d5c95f..e06df17d42e 100644
--- a/bindings/rust/tests/integration_tests.rs
+++ b/bindings/rust/tests/integration_tests.rs
@@ -1795,39 +1795,32 @@ async fn test_ghost_commits() {
}
}
-/// AUTOINCREMENT is n... | true |
tursodatabase/turso | 7,137 | comment_to_fix | feat: add PostgreSQL-style sequences and MVCC-safe AUTOINCREMENT | We *really* need to avoid doing this synchronously. I have a local branch where I am working on trying to remove `io.wait_for_completion()` and `io.block()` from the IO trait entirely, because this hangs on platforms like WASM where the completions must be driven by the external runtime and it makes multi-tenancy much ... | 7715979bd0d3118c3f44614cba11847693cd3ea6 | 20b7c23c7fa261ca91d2e642c331f06eeb68d30c | diff --git a/core/mvcc/database/checkpoint_state_machine.rs b/core/mvcc/database/checkpoint_state_machine.rs
index abff34fff1f..2075b858854 100644
--- a/core/mvcc/database/checkpoint_state_machine.rs
+++ b/core/mvcc/database/checkpoint_state_machine.rs
@@ -56,6 +56,16 @@ pub enum CheckpointState {
DeleteIndexRowSt... | [
"core/mvcc/database/checkpoint_state_machine.rs"
] | [
{
"comment": "We *really* need to avoid doing this synchronously. I have a local branch where I am working on trying to remove `io.wait_for_completion()` and `io.block()` from the IO trait entirely, because this hangs on platforms like WASM where the completions must be driven by the external runtime and it mak... | true | ||
tursodatabase/turso | 7,285 | issue_to_patch | @tursodatabase/database db.all() rows lose positional values for duplicate column names
## Summary
`@tursodatabase/database@0.7.0-pre.4` appears to lose positional row values when `db.all()` runs a query that returns duplicate column names.
Small repro repo:
https://github.com/berenddeboer/turso-duplicate-columns-r... | Preserve JS row positional values | ## Description
I think JS has problems overall. But my guess here is that there is some positional property that we were not adding.
## Motivation and context
Closes https://github.com/tursodatabase/turso/issues/7278
## Description of AI Usage
Vibed as Im not quite a JS script kiddie | db53f25e409348d13d078cb08cc331e0619ef674 | 4c0febfed21c47dad1ec953829a2bc38b88c7cbb | diff --git a/bindings/javascript/src/lib.rs b/bindings/javascript/src/lib.rs
index bc82138384..ae76949f6a 100644
--- a/bindings/javascript/src/lib.rs
+++ b/bindings/javascript/src/lib.rs
@@ -834,22 +834,32 @@ impl Statement {
to_js_value(env, value, safe_integers)?
}
Presentat... | [
"bindings/javascript/packages/native/compat.test.ts",
"bindings/javascript/packages/native/promise.test.ts",
"bindings/javascript/src/lib.rs",
"serverless/javascript/src/connection.ts",
"serverless/javascript/src/row.ts",
"serverless/javascript/src/statement.ts",
"testing/conformance/javascript/__test__... | [] | diff --git a/bindings/javascript/packages/native/compat.test.ts b/bindings/javascript/packages/native/compat.test.ts
index a605c7df79..35f97e2f93 100644
--- a/bindings/javascript/packages/native/compat.test.ts
+++ b/bindings/javascript/packages/native/compat.test.ts
@@ -30,6 +30,20 @@ test('exec multiple statements', a... | true |
tursodatabase/turso | 7,409 | issue_to_patch | core/mvcc: Call checkpoint hooks during bootstrap recovery | ## Description
Needed so that our checkpoint code calls the hooks that are defined in DurableStorage during bootstrap. Also removes the `durable_txid_max` as we dont use it for anything | 472a13c55db3a94639c141390d30127f1e3632dd | 2ff374ddc34923b70850ef11e2bc966408008734 | diff --git a/core/mvcc/database/checkpoint_state_machine.rs b/core/mvcc/database/checkpoint_state_machine.rs
index 4b58863c059..abff34fff1f 100644
--- a/core/mvcc/database/checkpoint_state_machine.rs
+++ b/core/mvcc/database/checkpoint_state_machine.rs
@@ -1174,9 +1174,7 @@ impl<Clock: LogicalClock> CheckpointStateMach... | [
"core/mvcc/database/checkpoint_state_machine.rs",
"core/mvcc/database/mod.rs",
"core/mvcc/database/tests.rs",
"core/mvcc/persistent_storage/mod.rs"
] | [
{
"comment": "Duplicated comment?",
"path": "core/mvcc/persistent_storage/mod.rs",
"hunk": "@@ -89,19 +89,14 @@ pub trait DurableStorage: Send + Sync + Debug {\n fn set_header(&self, header: logical_log::LogHeader);\n \n /// Called when a checkpoint begins, before any rows are written to the B-t... | true | ||
tursodatabase/turso | 7,399 | issue_to_patch | Resolve cargo artifact dir via scripts/cargo-target-dir | Scripts that hardcoded target/debug or target/release now ask the
scripts/cargo-target-dir helper for cargo's actual artifact directory,
so they keep working when CARGO_TARGET_DIR points elsewhere.
| 4070829e9baae43b833e3436981638e0ab63d9d0 | 7c679251becefcf9447c12157fab3abb394789c7 | diff --git a/perf/clickbench/benchmark.sh b/perf/clickbench/benchmark.sh
index a0105d3201..778caa8362 100755
--- a/perf/clickbench/benchmark.sh
+++ b/perf/clickbench/benchmark.sh
@@ -3,7 +3,7 @@
# https://github.com/ClickHouse/ClickBench/tree/main/sqlite
REPO_ROOT=$(git rev-parse --show-toplevel)
-RELEASE_BUILD_DIR... | [
"perf/clickbench/benchmark.sh",
"perf/clickbench/run.sh",
"perf/connection/limbo/run-benchmark.sh",
"perf/connection/rusqlite/run-benchmark.sh",
"perf/latency/limbo/run-benchmark.sh",
"perf/latency/rusqlite/run-benchmark.sh",
"perf/throughput/rusqlite/scripts/bench.sh",
"perf/throughput/turso/scripts/... | [] | true | ||
tursodatabase/turso | 7,379 | issue_to_patch | core/storage: Only mark WAL initialized after a successful header sync | prepare_wal_finish's sync completion callback ignored its result and
called mark_initialized() unconditionally. Because the completion
machinery runs the sync callback on failure as well as success, a failed
header fsync still flipped the in-memory initialized flag to true. After
that, prepare_wal_start short-circuits ... | d001d54aec57b6dc88de14d654f573b495ae484e | 6fd58f40606c46eec807631933b64960b4ef9d93 | diff --git a/core/storage/wal.rs b/core/storage/wal.rs
index a7bcda8f1b..becd996629 100644
--- a/core/storage/wal.rs
+++ b/core/storage/wal.rs
@@ -4004,8 +4004,14 @@ impl Wal for WalFile {
let file = self.coordination.wal_file()?;
let coordination = self.coordination.clone();
let c = file.syn... | [
"core/storage/wal.rs"
] | [] | true | ||
tursodatabase/turso | 7,405 | issue_to_patch | fix test_normalize_ident: impl was changed, test was not | 112eb468a | 03228a23b112970a40603a25f3859b51515d9f25 | 466a8ac5e9ab8c646191e941561e2cb6ffcff9a3 | diff --git a/core/util.rs b/core/util.rs
index a10572bd54..60c23ba437 100644
--- a/core/util.rs
+++ b/core/util.rs
@@ -4781,7 +4781,9 @@ pub mod tests {
fn test_normalize_ident() {
assert_eq!(normalize_ident("foo"), "foo");
assert_eq!(normalize_ident("FOO"), "foo");
- assert_eq!(normalize_... | [
"core/util.rs"
] | [] | true | ||
tursodatabase/turso | 7,406 | issue_to_patch | Discuss "can I work on it" in CONTRIBUTING.md | 03228a23b112970a40603a25f3859b51515d9f25 | b785312de0f136cbe1215cb3ec87242d249c3d63 | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index fabbaabe57..dba297e7ec 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -200,6 +200,14 @@ cargo run -Zbuild-std --target x86_64-unknown-linux-gnu -p turso_stress -- --vfs
The issue tracker has issues tagged with [good first issue](https://github.com/tursodataba... | [
"CONTRIBUTING.md"
] | [] | true | |||
tursodatabase/turso | 5,404 | issue_to_patch | WAL Read Lock Leak After ROLLBACK Prevents Checkpoint
## Description
`ROLLBACK` of a write transaction leaks a WAL read lock, causing checkpoint to fail on shutdown. No data loss occurs.
## Reproducer
```sql
CREATE TABLE t(x);
BEGIN;
INSERT INTO t VALUES(1);
ROLLBACK;
-- On shutdown:
```
## Error Message
```
ERROR: ... | fix(wal): release WAL read lock on rollback to prevent checkpoint busy | ## Description
Fix WAL read lock leak after `ROLLBACK` that caused checkpoint to fail with `Database is busy` on shutdown.
`reset_internal_states()` cleared the connection's `max_frame_read_lock_index` to `NO_LOCK_HELD` without first unlocking the corresponding `shared.read_locks[slot]`. When `pager.rollback_tx()... | 83bb9df47ad763fd5ea1c34a43f34c22cdcfa2e6 | 66cff98cc8c943994e25c103af9cd4fdf601c8b1 | diff --git a/core/storage/pager.rs b/core/storage/pager.rs
index 7fcbf1702c..2ac1f9f068 100644
--- a/core/storage/pager.rs
+++ b/core/storage/pager.rs
@@ -3716,8 +3716,11 @@ impl Pager {
return_if_io!(self.with_header(|header| header.database_size)).get();
let page_size = s... | [
"core/storage/pager.rs",
"core/storage/wal.rs",
"core/vdbe/execute.rs",
"tests/integration/wal/test_wal.rs"
] | [] | diff --git a/tests/integration/wal/test_wal.rs b/tests/integration/wal/test_wal.rs
index ff3f241f13..ca64b8ed48 100644
--- a/tests/integration/wal/test_wal.rs
+++ b/tests/integration/wal/test_wal.rs
@@ -41,6 +41,29 @@ fn test_wal_checkpoint_result(tmp_db: TempDatabase) -> Result<()> {
Ok(())
}
+#[allow(clippy::... | true |
tursodatabase/turso | 5,337 | issue_to_patch | Return exit code 1 from CLI when a query fails
Our CLI always returns exit code 0, even if a query fails. This currently generates a lot of false positives in fuzz testing.
Compare with SQLite's CLI:
```
sqlite3 :memory: "select 'one'; select * from t; select 'two';"; echo $?
one
Error: in prepare, no such table: t
... | Fix CLI exit code on query failure | ## Description
Return exit code 1 from the CLI when a query fails in non-interactive mode, matching sqlite3 behavior.
**cli/app.rs** — Track query errors via a `had_query_error` flag on the `Limbo` struct, set at both prepare-time (in `run_query`) and step-time (in `handle_step_error`).
**cli/main.rs** — In no... | e29a7815f165fd430e1a2f8dc2f36de771d86be6 | b516b2cefbaeb159576444677dc21b0010785925 | diff --git a/cli/app.rs b/cli/app.rs
index 0256dda729..43ae0000af 100644
--- a/cli/app.rs
+++ b/cli/app.rs
@@ -105,6 +105,7 @@ pub struct Limbo {
read_state: ReadState,
pub rl: Option<Editor<LimboHelper, DefaultHistory>>,
config: Option<Config>,
+ had_query_error: bool,
}
struct QueryStatistics {
... | [
"cli/app.rs",
"cli/main.rs",
"cli/tests/non_interactive_exit_code.rs",
"testing/runner/src/backends/cli.rs"
] | [
{
"comment": "`run_query` uses a baseline (`had_error_before`) to detect step-time errors via `self.had_query_error != had_error_before`. If `had_query_error` is already `true` before entering `run_query` (e.g., a prior query errored earlier in the same non-interactive stdin session), a new runtime/step error w... | diff --git a/cli/tests/non_interactive_exit_code.rs b/cli/tests/non_interactive_exit_code.rs
new file mode 100644
index 0000000000..fa2b5a91fd
--- /dev/null
+++ b/cli/tests/non_interactive_exit_code.rs
@@ -0,0 +1,221 @@
+use std::io::Write;
+use std::process::{Command, Stdio};
+
+// ------------------------------------... | true |
tursodatabase/turso | 5,497 | issue_to_patch | Integrate SQLite TCL tests with native TCL module
## Problem
Currently, our SQLite compatibility test harness (testing/sqlite3/tester.tcl) uses an external process approach - it shells out to `limbo-sqlite3` CLI for each SQL command and parses the text output. This works but has significant limitations compared to SQ... | Add native TCL extension for in-process SQLite test harness | ## Description
Replace the subprocess-per-statement TCL test shim with a native C extension (bindings/tcl/turso_tcl.c) backed by the existing SQLite C ABI in sqlite3/src/lib.rs. This closes three capability gaps in the test harness:
1. db errorcode now returns real engine error codes (was always 0)
2. db chang... | 20b23144514801785b8e81567f05aeb7f46b3ee9 | a6a220ce550be920e51932032096726e2417404e | diff --git a/.gitignore b/.gitignore
index 1285f564dd..e762d52a09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
**/target
*.so
+*.dylib
*.ipynb
*.o
*.sqlite
diff --git a/Cargo.lock b/Cargo.lock
index 01a14721e4..6f946ac8f5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6389,6 +6389,7 @@ dependencies = [... | [
".gitignore",
"Cargo.lock",
"bindings/tcl/Makefile",
"bindings/tcl/test_probes.tcl",
"bindings/tcl/turso_tcl.c",
"sqlite3/Cargo.toml",
"sqlite3/src/lib.rs",
"testing/sqlite3/tester.tcl"
] | [] | diff --git a/bindings/tcl/test_probes.tcl b/bindings/tcl/test_probes.tcl
new file mode 100644
index 0000000000..b5bce5a803
--- /dev/null
+++ b/bindings/tcl/test_probes.tcl
@@ -0,0 +1,103 @@
+# Probe tests for the native Turso TCL extension (bindings/tcl/turso_tcl.c).
+#
+# Validates the three capabilities that the subp... | true |
tursodatabase/turso | 6,554 | issue_to_patch | Correlated subquery inside aggregate returns wrong grouped result
### Repro
```sql
CREATE TABLE t1(grp TEXT, val INTEGER);
CREATE TABLE t2(grp TEXT, factor INTEGER);
INSERT INTO t1 VALUES ('a',1),('a',2),('b',3),('b',4);
INSERT INTO t2 VALUES ('a',10),('b',20);
SELECT grp, sum((SELECT factor FROM t2 WHERE t2.grp = t1.... | fix correlated subquery inside aggregate with GROUP BY | collect correlated SubqueryResult expressions as leaf columns in the GROUP BY sorter so the sorter loop reads the per-row value instead of a stale register from the last scanned row.
fixes #6485
used Claude Code | c7db6cce2c46060048acd07615c7964c25a2a42d | 0ced5f222f32367a5239a8095db07bb25c03ee8c | diff --git a/core/translate/group_by.rs b/core/translate/group_by.rs
index 9b485da68b..f47e51b547 100644
--- a/core/translate/group_by.rs
+++ b/core/translate/group_by.rs
@@ -337,6 +337,12 @@ pub fn compute_group_by_sort_order(
/// These are the base table columns that aggregate expressions depend on.
/// By storing ... | [
"core/translate/group_by.rs",
"testing/sqltests/tests/correlated-subquery-aggregate-groupby.sqltest"
] | [] | diff --git a/testing/sqltests/tests/correlated-subquery-aggregate-groupby.sqltest b/testing/sqltests/tests/correlated-subquery-aggregate-groupby.sqltest
new file mode 100644
index 0000000000..436bffb9ea
--- /dev/null
+++ b/testing/sqltests/tests/correlated-subquery-aggregate-groupby.sqltest
@@ -0,0 +1,53 @@
+@database ... | true |
tursodatabase/turso | 6,700 | issue_to_patch | ORDER BY / GROUP BY Column-Number with COLLATE Ignored
```sql
CREATE TABLE t(x TEXT);
INSERT INTO t VALUES('b'),('A'),('c'),('a');
SELECT x FROM t ORDER BY 1 COLLATE NOCASE;
-- SQLite: A, a, b, c (case-insensitive sort)
-- Turso: b, A, c, a (insertion order)
```
```sql
SELECT x, sum(v) FROM t GROUP BY 1 COLLATE NO... | core/translate: Fix ordinal ORDER BY and GROUP BY with COLLATE | ## Summary
- resolve ordinal ORDER BY/GROUP BY terms through COLLATE and single parentheses before binding
- add regressions for ORDER BY 1 COLLATE NOCASE, GROUP BY 1 COLLATE NOCASE, and ORDER BY (1) COLLATE NOCASE
## Why
SQLite treats integer ORDER BY/GROUP BY terms as result-column references even when they are wrap... | 4070829e9baae43b833e3436981638e0ab63d9d0 | 28d600d8cb4ac23fecd9210dc18b297362ca55ab | diff --git a/core/translate/select.rs b/core/translate/select.rs
index 7b1238ec21..de7df0decb 100644
--- a/core/translate/select.rs
+++ b/core/translate/select.rs
@@ -1076,6 +1076,20 @@ fn replace_column_number_with_copy_of_column_expr(
columns: &[ResultSetColumn],
clause_name: &str,
) -> Result<()> {
+ m... | [
"core/translate/select.rs",
"testing/sqltests/tests/collate.sqltest"
] | [] | diff --git a/testing/sqltests/tests/collate.sqltest b/testing/sqltests/tests/collate.sqltest
index 6f99294ad9..513331c715 100644
--- a/testing/sqltests/tests/collate.sqltest
+++ b/testing/sqltests/tests/collate.sqltest
@@ -1241,6 +1241,92 @@ expect {
CHERRY
}
+@cross-check-integrity
+test collate_orderby_ordina... | true |
tursodatabase/turso | 7,404 | issue_to_patch | fix: materialize DELETE rowset when FK cascade triggers back to target | Resurrect #6606 because author doesn't allow force-pushing to branch | c379bb9de69e39320196d4772d916ab8d32f7b01 | 193d06d49269c4c249ae37e822936c9d3d034415 | diff --git a/core/translate/delete.rs b/core/translate/delete.rs
index 6779f0e486..fa963e68bd 100644
--- a/core/translate/delete.rs
+++ b/core/translate/delete.rs
@@ -1,4 +1,4 @@
-use crate::schema::Table;
+use crate::schema::{BTreeTable, Table};
use crate::sync::Arc;
use crate::translate::emitter::{emit_program, Res... | [
"core/translate/delete.rs",
"testing/sqltests/tests/trigger_fk_cascade.sqltest"
] | [] | diff --git a/testing/sqltests/tests/trigger_fk_cascade.sqltest b/testing/sqltests/tests/trigger_fk_cascade.sqltest
index 7878011c28..d0b1e13bdd 100644
--- a/testing/sqltests/tests/trigger_fk_cascade.sqltest
+++ b/testing/sqltests/tests/trigger_fk_cascade.sqltest
@@ -124,3 +124,106 @@ expect {
2|p2
3|2|c3
}
+... | true | |
tursodatabase/turso | 7,389 | issue_to_patch | core/translate: preserve declaration order when nesting window subqueries | ## Background stuff
prepare_window_subquery rewrites a SELECT with window functions into a stack of nested subqueries — one layer per window. Each call pops one window off the queue and assigns it to the outermost layer it is currently building.
## Bug
Popping with swap_remove(0) is O(1) but swaps in the last el... | 1c49e23a3157ffb1ff519e5ddbf525e894576465 | a0e7bddf274c13e733209ac0649252d68d4e31e3 | diff --git a/core/translate/window.rs b/core/translate/window.rs
index 0814bdd81a..4494000a8a 100644
--- a/core/translate/window.rs
+++ b/core/translate/window.rs
@@ -130,7 +130,12 @@ fn prepare_window_subquery(
return Ok(());
}
- let mut current_window = windows.swap_remove(0);
+ // Layer windows... | [
"core/translate/window.rs",
"testing/sqltests/tests/snapshot_tests/windows/snapshots/windows__multiple-windows.snap",
"testing/sqltests/tests/window/multi-window-ordering.sqltest"
] | [] | diff --git a/testing/sqltests/tests/snapshot_tests/windows/snapshots/windows__multiple-windows.snap b/testing/sqltests/tests/snapshot_tests/windows/snapshots/windows__multiple-windows.snap
index b0c559df45..a7528d23d1 100644
--- a/testing/sqltests/tests/snapshot_tests/windows/snapshots/windows__multiple-windows.snap
++... | true | |
tursodatabase/turso | 6,674 | issue_to_patch | feat: REINDEX | Implements `REINDEX` to repopulate an index or indexes.
`REINDEX;` - repopulates all indexes
`REINDEX table_name;` - repopulates all indexes of `table_name`, including when it doesn't have any
`REINDEX index_name;` - repopulates this specific index
`REINDEX nocase;` - repopulates all indexes using `COLLATE ... | c379bb9de69e39320196d4772d916ab8d32f7b01 | af289b24ad75edfc8213d74481c0dfe1cc696a4c | diff --git a/COMPAT.md b/COMPAT.md
index ce9e1fbe2b..6b301d3e0f 100644
--- a/COMPAT.md
+++ b/COMPAT.md
@@ -107,7 +107,7 @@ ongoing work to pass the full SQLite TCL test suite.
| INSERT | ✅ Yes | |
| INSERT ... ON ... | [
"COMPAT.md",
"bindings/javascript/packages/native/compat.test.ts",
"bindings/javascript/src/lib.rs",
"core/translate/collate.rs",
"core/translate/index.rs",
"core/translate/mod.rs",
"core/util.rs",
"core/vdbe/execute.rs",
"core/vdbe/explain.rs",
"core/vdbe/hash_table.rs",
"core/vdbe/insn.rs",
... | [
{
"comment": "nit: this is only ever called with either a register and `None`, or with a literal and the same literal in `clear_existing_root`. Other cases seem illegal to me. Could we make them impossible by changing the enum to have two variants `NewIndexRegister` and `IndexToRebuildRootPage`? It would also m... | diff --git a/bindings/javascript/packages/native/compat.test.ts b/bindings/javascript/packages/native/compat.test.ts
index a605c7df79..f9646e9396 100644
--- a/bindings/javascript/packages/native/compat.test.ts
+++ b/bindings/javascript/packages/native/compat.test.ts
@@ -1,6 +1,24 @@
import { unlinkSync } from "node:fs... | true | |
tursodatabase/turso | 7,402 | issue_to_patch | fix: spurious sqlite_stat1 NULL-idx rows emitted by ANALYZE | Resurrect #6347 because author does not allow force push to branch | 4070829e9baae43b833e3436981638e0ab63d9d0 | 724ff8193dcedb0b23cb3366170cfe72e3555e31 | diff --git a/core/translate/analyze.rs b/core/translate/analyze.rs
index 1a5c42af5e..fdec769428 100644
--- a/core/translate/analyze.rs
+++ b/core/translate/analyze.rs
@@ -348,65 +348,14 @@ pub fn translate_analyze(
root_page: target_table.root_page,
db: database_id,
});
- let r... | [
"core/translate/analyze.rs",
"testing/sqltests/tests/snapshot_tests/analyze/snapshots/analyze__analyze-all-stat1-exists.snap",
"testing/sqltests/tests/snapshot_tests/analyze/snapshots/analyze__analyze-all.snap",
"testing/sqltests/tests/snapshot_tests/analyze/snapshots/analyze__analyze-database.snap",
"testi... | [] | diff --git a/testing/sqltests/tests/snapshot_tests/analyze/snapshots/analyze__analyze-all-stat1-exists.snap b/testing/sqltests/tests/snapshot_tests/analyze/snapshots/analyze__analyze-all-stat1-exists.snap
index 8571dce292..fb7be26381 100644
--- a/testing/sqltests/tests/snapshot_tests/analyze/snapshots/analyze__analyze-... | true | |
tursodatabase/turso | 7,401 | issue_to_patch | fix: handle rowid-alias columns in composite FK key probes | Extracted (cherry-picked) from https://github.com/tursodatabase/turso/pull/7262
The FK bytecode path assumed composite key values were in contiguous registers.
That is usually true for normal columns, but not for `INTEGER PRIMARY KEY`
columns. In SQLite, an `INTEGER PRIMARY KEY` is a rowid alias, so Turs... | 4070829e9baae43b833e3436981638e0ab63d9d0 | 8a9eab2cf91e8dc9179603f9ec7f661ce357196b | diff --git a/core/translate/emitter/mod.rs b/core/translate/emitter/mod.rs
index a4e57f9d99..e28bd5c7a1 100644
--- a/core/translate/emitter/mod.rs
+++ b/core/translate/emitter/mod.rs
@@ -1733,18 +1733,13 @@ pub(crate) fn init_limit(
Ok(())
}
-/// Emits `target_columns`, plus the stored columns needed by `targe... | [
"core/translate/emitter/mod.rs",
"core/translate/fkeys.rs",
"testing/sqltests/tests/foreign_keys.sqltest"
] | [] | diff --git a/testing/sqltests/tests/foreign_keys.sqltest b/testing/sqltests/tests/foreign_keys.sqltest
index c6426e6aa9..f74cff91ae 100644
--- a/testing/sqltests/tests/foreign_keys.sqltest
+++ b/testing/sqltests/tests/foreign_keys.sqltest
@@ -1584,6 +1584,48 @@ expect {
10|7|7
}
+# Composite child FK whose firs... | true | |
tursodatabase/turso | 6,662 | issue_to_patch | core/vdbe: Make scalar function edge cases SQLite compatible | ## What changed
- Accept ASCII whitespace around numeric date/time strings, matching SQLite behavior for inputs like `unixepoch('5 ')`.
- Fix `substr()` handling for extreme negative start and negative length values so it returns the same empty result as SQLite.
- Add core unit coverage and SQL regression tests for bot... | 88a809e92fb01ed85e4d4b09e1042388aa8b0ab8 | 9cd16dc8327dc556f79ef12d9710e52339123e22 | diff --git a/core/functions/datetime.rs b/core/functions/datetime.rs
index e0de69fc96..53d7fdf959 100644
--- a/core/functions/datetime.rs
+++ b/core/functions/datetime.rs
@@ -219,7 +219,8 @@ fn parse_date_or_time(value: &str, p: &mut DateTime) -> Result<()> {
set_to_current(p);
return Ok(());
}
-... | [
"core/functions/datetime.rs",
"core/vdbe/value.rs",
"testing/sqltests/tests/scalar-functions.sqltest"
] | [] | diff --git a/testing/sqltests/tests/scalar-functions.sqltest b/testing/sqltests/tests/scalar-functions.sqltest
index 991379f935..88a3000ad5 100644
--- a/testing/sqltests/tests/scalar-functions.sqltest
+++ b/testing/sqltests/tests/scalar-functions.sqltest
@@ -1155,6 +1155,24 @@ test substr-large-float-clamp {
expect {
... | true | |
tursodatabase/turso | 6,659 | issue_to_patch | core/vdbe: Fix AVG() for text values with numeric prefixes | Fix `AVG()` for text values with numeric prefixes so it matches SQLite.
This came up while validating the large-integer `AVG()` fix in #6648. Values like `'9007199254740994abc'` were still handled differently from SQLite.
In `core/vdbe/execute.rs`, `AVG()` now sends text values with numeric prefixes down the floa... | 88a809e92fb01ed85e4d4b09e1042388aa8b0ab8 | 057608f1141f8e0240b5177f206396f643db75ef | diff --git a/core/vdbe/execute.rs b/core/vdbe/execute.rs
index 8bb01416a3..2da728740f 100644
--- a/core/vdbe/execute.rs
+++ b/core/vdbe/execute.rs
@@ -5792,16 +5792,27 @@ fn update_agg_payload(
Value::Numeric(Numeric::Float(f)) => {
apply_kbn_step(sum_val, f64::from(f), &mut sum_st... | [
"core/vdbe/execute.rs",
"testing/sqltests/tests/agg-functions/avg-text-types.sqltest"
] | [] | diff --git a/testing/sqltests/tests/agg-functions/avg-text-types.sqltest b/testing/sqltests/tests/agg-functions/avg-text-types.sqltest
new file mode 100644
index 0000000000..5b66e83b39
--- /dev/null
+++ b/testing/sqltests/tests/agg-functions/avg-text-types.sqltest
@@ -0,0 +1,36 @@
+@database :memory:
+
+@cross-check-in... | true | |
tursodatabase/turso | 7,314 | issue_to_patch | Pin cargo-c to 0.10.16 due to rust-toolchain.toml being pegged at 1.88 | ## Description
Pinned the `cargo-c` install version to `0.10.16` due to `rust-toolchain.toml` pegging the channel at `1.88`.
## Motivation and context
I was setting up the turso repo and encountered the issue with installing `cargo-c`. `cargo-c` is now at `0.10.23` and requires `1.94` or newer, but the `rust-t... | a1f3660d70f32ba46ec6fc11ebb405d78fe33791 | 73756451b62833df7d4e5aa7cd80364a1fce0947 | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 70688c4eb0..fabbaabe57 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -231,7 +231,7 @@ The purpose of these tests is to verify behavior matches with SQLite and Turso.
1. [Cargo-c](https://github.com/lu-zero/cargo-c) is needed for building C-ABI compatible l... | [
"CONTRIBUTING.md"
] | [] | true | ||
tursodatabase/turso | 7,380 | issue_to_patch | R3 - LEFT JOIN returns incorrect rows when ON predicate includes OR false
```sql
CREATE TABLE l(k INTEGER);
CREATE TABLE rr(k INTEGER);
INSERT INTO l VALUES (0),(1);
INSERT INTO rr VALUES (0),(1);
SELECT a.k, d.k
FROM l AS a
LEFT JOIN (
SELECT b.k
FROM l AS b
JOIN rr AS c ON b.k = c.k
) AS d
ON (a.k >= d.k) OR ... | core/translate: nest FROM-clause subquery coroutine bodies to fix hash join bugs | A FROM-clause subquery that contains an internal hash join is compiled into a coroutine. The build side of the hash join is guarded by `Once` so it survives re-invocations of the coroutine, but the matching `HashClose` was being emitted at the end of the coroutine body.
`HashClose` removes the hash table from `Progr... | d001d54aec57b6dc88de14d654f573b495ae484e | 6f83c7b066635de667ff0a83a36a224a944b3a23 | diff --git a/core/translate/subquery.rs b/core/translate/subquery.rs
index 1f0f3cdd4c..6962b18feb 100644
--- a/core/translate/subquery.rs
+++ b/core/translate/subquery.rs
@@ -1525,56 +1525,64 @@ pub fn emit_from_clause_subquery(
});
program.preassign_label_to_next_insn(coroutine_implementation_start_offset);
... | [
"core/translate/subquery.rs",
"testing/sqltests/tests/joins/derived_subquery_on_predicate.sqltest",
"testing/sqltests/tests/snapshot_tests/tpch/snapshots/tpch__q13-customer-distribution.snap"
] | [] | diff --git a/testing/sqltests/tests/joins/derived_subquery_on_predicate.sqltest b/testing/sqltests/tests/joins/derived_subquery_on_predicate.sqltest
new file mode 100644
index 0000000000..1883ecb983
--- /dev/null
+++ b/testing/sqltests/tests/joins/derived_subquery_on_predicate.sqltest
@@ -0,0 +1,306 @@
+@database :memo... | true |
tursodatabase/turso | 7,287 | issue_to_patch | core/mvcc: avoid SeekingToLast with MVCC in newrowid |
## Description
`DISABLE_CHECKPOINT_BENCHMARK=1 cargo bench -p turso_core --bench benchmark -- "Insert rows in batches/limbo_mvcc_insert"`
Benchmark with inserts and disabled checkpoint to skip noise of checkpoints
```bash
Insert rows in batches/limbo_mvcc_insert_1_rows
time: [29.609... | d935a2635b1eab87efb519483c70884f3b366dc0 | 1c4893d9430b1dabee1b3ce2f0920d714fb3d352 | diff --git a/core/benches/benchmark.rs b/core/benches/benchmark.rs
index cadf536d0b..a8a590f5c7 100644
--- a/core/benches/benchmark.rs
+++ b/core/benches/benchmark.rs
@@ -573,6 +573,9 @@ fn bench_execute_select_count(criterion: &mut Criterion) {
fn bench_insert_rows(criterion: &mut Criterion) {
// The rusqlite be... | [
"core/benches/benchmark.rs",
"core/vdbe/execute.rs"
] | [
{
"comment": "`mvcc_already_initialized` is now always false, do you think we could just remove it?",
"path": "core/vdbe/execute.rs",
"hunk": "@@ -10106,10 +10110,9 @@ fn new_rowid_inner(\n state.registers[*prev_largest_reg]\n .... | true | ||
twigphp/Twig | 4,841 | issue_to_patch | Fix Markup truthiness in boolean expressions | ## Summary
Fixes Markup truthiness handling in boolean expressions.
`trim` can return a `Twig\Markup` instance for safe strings. Empty `Markup` objects must behave like empty strings in Twig truth tests, but PHP treats all objects as truthy. This caused expressions like this to incorrectly evaluate as true:
```... | 7f9714a13e26afa53c8e5ef0cd07f97adb230e17 | f5afaabf54290b920a1a13a890b027d4cb9415a4 | diff --git a/src/Node/Expression/Binary/AndBinary.php b/src/Node/Expression/Binary/AndBinary.php
index 454ea70e5b2..7ccef174bdf 100644
--- a/src/Node/Expression/Binary/AndBinary.php
+++ b/src/Node/Expression/Binary/AndBinary.php
@@ -14,9 +14,16 @@
use Twig\Compiler;
use Twig\Node\Expression\ReturnBoolInterface;
+us... | [
"src/Node/Expression/Binary/AndBinary.php",
"src/Node/Expression/Binary/ElvisBinary.php",
"src/Node/Expression/Binary/OrBinary.php",
"src/Node/Expression/Binary/XorBinary.php",
"src/Node/Expression/Ternary/ConditionalTernary.php",
"src/Node/Expression/Test/TrueTest.php",
"src/Node/Expression/Unary/NotUn... | [] | diff --git a/src/Node/Expression/Test/TrueTest.php b/src/Node/Expression/Test/TrueTest.php
index f830b8f2e57..f0c49d476fc 100644
--- a/src/Node/Expression/Test/TrueTest.php
+++ b/src/Node/Expression/Test/TrueTest.php
@@ -12,7 +12,10 @@
namespace Twig\Node\Expression\Test;
use Twig\Compiler;
+use Twig\Node\Expressio... | true | |
twigphp/Twig | 4,842 | issue_to_patch | Fix a PHP 8.5 chr() deprecation when decoding octal string escapes | PHP 8.5 deprecates passing a value outside the `[0, 255]` range to `chr()`.
The string-escape decoder in `Lexer::stringEscape()` accepts up to three octal digits, so a template containing an escape such as `"\777"` (= 511) reaches `chr()` out of range and emits:
> `chr(): Providing a value not in-between 0 and 255 is... | 7f9714a13e26afa53c8e5ef0cd07f97adb230e17 | 153094b6016a88fae843271aa85a191378101209 | diff --git a/CHANGELOG b/CHANGELOG
index 92e60a2336b..88ebcfa16df 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.28.0 (2026-XX-XX)
+ * Fix a PHP 8.5 `chr()` deprecation when decoding an octal string escape sequence larger than `\377` (such as `"\777"`)
* Mark `Twig\Markup` as `@final`; it will be final... | [
"CHANGELOG",
"src/Lexer.php",
"tests/LexerTest.php"
] | [] | diff --git a/tests/LexerTest.php b/tests/LexerTest.php
index d75769c9f7a..90b1c3363a9 100644
--- a/tests/LexerTest.php
+++ b/tests/LexerTest.php
@@ -209,6 +209,18 @@ public static function getStringWithEscapedDelimiter()
EOF,
"\065\x64",
];
+ yield 'octal escape overflowing a s... | true | |
twigphp/Twig | 4,292 | issue_to_patch | Conditional {% use %} not working
**Version context:**
Twig version: v3.3.10
Twig Bridge version: 6.0.8
Symfony version: 6.0.8
PHP version: 8.1.5
**What's happening:**
I just tried to use a different twig trait depending on whether a form variable exists or not.
Below is a simplified version of my templ... | Introduce a CorrectnessNodeVisitor to validate that templates are semantically correct | This PR addresses several issues around the correctness of templates.
Being able to parse and compile a template does not mean that it is semantically correct. To enforce correctness, we currently have several places where we deal with it:
* `Parser::filterBodyNodes()`: This method is a mix of ensuring the correct... | 57e2f5c367b0feb6c476b24ab2a6128224013550 | c0504b90c57a30bf01dc09d1751bfcae28982f6e | diff --git a/CHANGELOG b/CHANGELOG
index 6ace2e0d6b9..92e60a2336b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,9 @@
* Report the column number in syntax errors and expose it via `Error::getTemplateColumn()`
* Track the source offset of each token and expose it via `Token::getOffset()`
* Fix nested `block()` ... | [
"CHANGELOG",
"doc/deprecated.rst",
"src/Extension/CoreExtension.php",
"src/Node/ConfigNode.php",
"src/Node/TextNode.php",
"src/NodeVisitor/CorrectnessNodeVisitor.php",
"src/Parser.php",
"src/Test/IntegrationTestCase.php",
"src/TokenParser/ExtendsTokenParser.php",
"src/TokenParser/MacroTokenParser.... | [
{
"comment": "what if there is a single parsed node with children ? `count($body)` would be truthy so it would iterate over the children of that node instead of checking the body",
"path": "src/NodeVisitor/CorrectnessNodeVisitor.php",
"hunk": "@@ -0,0 +1,131 @@\n+<?php\n+\n+/*\n+ * This file is part of ... | diff --git a/src/Test/IntegrationTestCase.php b/src/Test/IntegrationTestCase.php
index d4c5193719a..749174bdd21 100644
--- a/src/Test/IntegrationTestCase.php
+++ b/src/Test/IntegrationTestCase.php
@@ -230,7 +230,7 @@ public function getLegacyTests()
/**
* @return void
*/
- protected function doInteg... | true |
twigphp/Twig | 4,292 | comment_to_fix | Introduce a CorrectnessNodeVisitor to validate that templates are semantically correct | Is the filtering of the BOM gone ? | 57e2f5c367b0feb6c476b24ab2a6128224013550 | c0504b90c57a30bf01dc09d1751bfcae28982f6e | diff --git a/src/Parser.php b/src/Parser.php
index 62f14ebf5fd..5ef1aea8dc8 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -29,8 +29,6 @@
use Twig\Node\MacroNode;
use Twig\Node\ModuleNode;
use Twig\Node\Node;
-use Twig\Node\NodeCaptureInterface;
-use Twig\Node\NodeOutputInterface;
use Twig\Node\Nodes;
use Twi... | [
"src/Parser.php"
] | [
{
"comment": "Is the filtering of the BOM gone ?",
"path": "src/Parser.php",
"hunk": "@@ -334,50 +332,16 @@ public function getCurrentToken(): Token\n return $this->stream->getCurrent();\n }\n \n- private function filterBodyNodes(Node $node, bool $nested = false): ?Node\n+ private func... | true | ||
twigphp/Twig | 4,839 | issue_to_patch | Enforce the sandbox Markup exception for every security policy | This is (maybe) my last change in 4.x to remove things that were hardcoded in 3.x.
It moves the sandbox exception for `Twig\Markup` out of the default `SecurityPolicy` and into the runtime string-coercion check: now, only `__toString()` is allowed by default and custom security policies inherit that automatically.
... | c2c949d5bc3e82a79ed3f470540d00b97b31b2c5 | b1cac7c3abcc80c7f8773541657f6f13053a311c | diff --git a/CHANGELOG b/CHANGELOG
index a7652bc07bc..59f59f4e08d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
# 4.0.0 (2026-XX-XX)
* Add the `isAlwaysAllowedInSandbox()` method to `Twig\TwigCallableInterface` and `Twig\TokenParser\TokenParserInterface`
+ * Always allow printing a `Markup` object in a sa... | [
"CHANGELOG",
"src/Extension/SandboxExtension.php",
"src/Markup.php",
"src/Sandbox/SecurityPolicy.php",
"tests/Extension/SandboxTest.php"
] | [] | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index 60a8dc44ad3..bec619ac721 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -28,6 +28,7 @@
use Twig\Extension\SandboxExtension;
use Twig\Extension\StringLoaderExtension;
use Twig\Loader\ArrayLoader... | true | |
twigphp/Twig | 4,840 | issue_to_patch | Mark Markup as final | 612dc96c18c768fe5407e568c912158380f79336 | f938f6d153e703bdeb59f6cefa53bfe21ccf7ace | diff --git a/CHANGELOG b/CHANGELOG
index bf1b7b68931..6ace2e0d6b9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.28.0 (2026-XX-XX)
+ * Mark `Twig\Markup` as `@final`; it will be final in Twig 4.0
* Reduce memory usage and speed up the context restoration compiled at the end of `for` loops
* Allow cal... | [
"CHANGELOG",
"doc/deprecated.rst",
"src/Markup.php"
] | [] | true | |||
twigphp/Twig | 4,838 | issue_to_patch | Using macros with dynamic name using dot operator does not work in 3.x
While upgrading twig v1.30 to v3.22.0 i encountered some problem using macros from an external file and calling them by using a variable value as dynamic name.
When using V1.30, you could use the `attributes(macroalias, macroname, parameters)` fun... | Allow calling a macro with a dynamic name via the dot operator | Closes #4715 | aef7587fc8a0129633a199ba3a266c0bebbab6e4 | 87093aab9e913faf711ad0c28c6658a21d38306d | diff --git a/CHANGELOG b/CHANGELOG
index 972517c8cb4..55a17493c41 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
# 3.28.0 (2026-XX-XX)
* Reduce memory usage and speed up the context restoration compiled at the end of `for` loops
+ * Allow calling a macro with a dynamic name via the dot operator (`macros.(n... | [
"CHANGELOG",
"doc/tags/macro.rst",
"src/ExpressionParser/Infix/DotExpressionParser.php",
"src/Node/Expression/MacroReferenceExpression.php",
"tests/Extension/SandboxTest.php",
"tests/Fixtures/macros/dynamic_name.test",
"tests/Fixtures/macros/dynamic_name_nested.test",
"tests/Fixtures/macros/dynamic_na... | [] | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index bffe3e05399..6399c7bc990 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -699,6 +699,23 @@ public function testSandboxBlocksToStringOnDynamicAttributeName()
}
}
+ public function... | true |
twigphp/Twig | 4,835 | issue_to_patch | markdown_to_html different/incorrect behavior with leading line-break
I thought I was going mad at one point. I've simplified the issue to the following code:
```php
$loader = new \Twig\Loader\ArrayLoader([
'index' => '{{ text|markdown_to_html }}',
]);
$twig = new \Twig\Environment($loader);
$twig->addExt... | Fix markdown_to_html mangling content that starts with a blank line | Closes #3685 | afad02326d97efae1ff6bc3af828899fa10f3378 | 113aec62e7b3fa8462dfcda73f8e2504d08dece9 | diff --git a/CHANGELOG b/CHANGELOG
index 443f4f0101b..054da65661f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@
* Fix nested `block()` calls to resolve against the overriding template when a block rendered through `block(name, template)` calls `parent()`
* Stop reporting a skipped test in `IntegrationTes... | [
"CHANGELOG",
"extra/markdown-extra/MarkdownRuntime.php",
"extra/markdown-extra/Tests/FunctionalTest.php"
] | [] | diff --git a/extra/markdown-extra/Tests/FunctionalTest.php b/extra/markdown-extra/Tests/FunctionalTest.php
index 58fd7298e9f..9d5608253f1 100644
--- a/extra/markdown-extra/Tests/FunctionalTest.php
+++ b/extra/markdown-extra/Tests/FunctionalTest.php
@@ -17,6 +17,7 @@
use Twig\Extra\Markdown\ErusevMarkdown;
use Twig\Ex... | true |
twigphp/Twig | 4,819 | issue_to_patch | Add an allow-list for tests to the sandbox security policy | fa33c2278ee7c8013263d757abc8e5892d1f568d | 416d07da1d701173dc243c020e42be3427e65eab | diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index 204649b0e19..bc79c989dce 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -17,7 +17,7 @@
'single_line_throw' => false,
'ordered_imports' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', ... | [
".php-cs-fixer.dist.php",
"CHANGELOG",
"doc/deprecated.rst",
"doc/sandbox.rst",
"phpstan-baseline.neon",
"src/Extension/CoreExtension.php",
"src/Extension/SandboxExtension.php",
"src/Node/CheckSecurityNode.php",
"src/Node/Expression/Binary/NullCoalesceBinary.php",
"src/Node/Expression/Filter/Defau... | [] | diff --git a/tests/Extension/SandboxStateChangeTest.php b/tests/Extension/SandboxStateChangeTest.php
index f6981517c77..f6b1fcc6e23 100644
--- a/tests/Extension/SandboxStateChangeTest.php
+++ b/tests/Extension/SandboxStateChangeTest.php
@@ -413,10 +413,10 @@ public function __construct(private SecurityPolicyInterface $... | true | ||
twigphp/Twig | 4,837 | issue_to_patch | Reduce memory usage of the context restoration compiled at the end of for loops | Refs #4021
I benchmarked the new version and it's 10–15% faster CPU and half the allocations.
| 9a1d3d241f53ed5c056382c78d9a66532b69335a | 0197736dfc22adbe441ec50c16cf5c69c2655e76 | diff --git a/CHANGELOG b/CHANGELOG
index e89fde984d6..972517c8cb4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.28.0 (2026-XX-XX)
+ * Reduce memory usage and speed up the context restoration compiled at the end of `for` loops
* Report the column number in syntax errors and expose it via `Error::getTem... | [
"CHANGELOG",
"src/Node/ForNode.php",
"tests/Node/ForTest.php"
] | [] | diff --git a/tests/Node/ForTest.php b/tests/Node/ForTest.php
index 2fcf0fa7c04..9a642073ca4 100644
--- a/tests/Node/ForTest.php
+++ b/tests/Node/ForTest.php
@@ -77,7 +77,8 @@ public static function provideTests(): iterable
}
\$_parent = \$context['_parent'];
unset(\$context['_seq'], \$context['key'], \$context['item... | true | |
twigphp/Twig | 4,816 | issue_to_patch | Add an always_allowed_in_sandbox flag for filters, functions, and tags | Some filters, functions, and tags are pure and inherently safe to use in sandboxed templates. Forcing every sandbox policy to explicitly allow-list them is noisy.
Introduce an opt-in flag that lets callable and token-parser authors mark their item as always allowed in the sandbox. When set, the sandbox node visitor ... | e3c0c3fe5a6482b06f10d2328c1754626a70374d | cf4b50d181d673c5aa68fc94064f2cf1bfc6213e | diff --git a/CHANGELOG b/CHANGELOG
index 6cbe452cdda..e89fde984d6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,8 @@
* Cast printed expressions to string so values that cannot be converted to a string (arrays, non-`Stringable` objects, ...) report a usable stack trace at the print location
* Make the `include()... | [
"CHANGELOG",
"doc/deprecated.rst",
"doc/sandbox.rst",
"src/AbstractTwigCallable.php",
"src/Attribute/AsTwigFilter.php",
"src/Attribute/AsTwigFunction.php",
"src/Attribute/AsTwigTest.php",
"src/ExpressionParser/Infix/FunctionExpressionParser.php",
"src/Extension/AttributeExtension.php",
"src/NodeVi... | [] | diff --git a/tests/Extension/AttributeExtensionTest.php b/tests/Extension/AttributeExtensionTest.php
index f6b6d9242cc..c5d9ddd394b 100644
--- a/tests/Extension/AttributeExtensionTest.php
+++ b/tests/Extension/AttributeExtensionTest.php
@@ -51,8 +51,10 @@ public static function provideFilters()
yield 'with con... | true | |
twigphp/Twig | 4,834 | issue_to_patch | Track the source offset of each token and expose it in syntax errors | afad02326d97efae1ff6bc3af828899fa10f3378 | 3868bac531632682160b8e5885b16eba8a137a5a | diff --git a/CHANGELOG b/CHANGELOG
index 443f4f0101b..6cbe452cdda 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,7 @@
-# 3.27.2 (2026-XX-XX)
+# 3.28.0 (2026-XX-XX)
+ * Report the column number in syntax errors and expose it via `Error::getTemplateColumn()`
+ * Track the source offset of each token and expose it vi... | [
"CHANGELOG",
"src/Environment.php",
"src/Error/Error.php",
"src/Lexer.php",
"src/Source.php",
"src/Token.php",
"src/TokenStream.php",
"tests/ExpressionParserTest.php",
"tests/Fixtures/exceptions/syntax_error_in_reused_template.test",
"tests/Fixtures/expressions/underscored_numbers_error.test",
"... | [] | diff --git a/tests/ExpressionParserTest.php b/tests/ExpressionParserTest.php
index 7bf164d34b2..b48f8d6136e 100644
--- a/tests/ExpressionParserTest.php
+++ b/tests/ExpressionParserTest.php
@@ -414,7 +414,7 @@ public function testMacroDefinitionDoesNotSupportNonNameVariableName()
$parser = new Parser($env);
... | true | ||
twigphp/Twig | 4,836 | issue_to_patch | [question] How to pass options to Parsedown using the new markdown filters?
For example, to prevent XSS, I would use this:
```
$Parsedown->setSafeMode(true);
```
Source: https://github.com/erusev/parsedown#security
But using the `markdown_to_html` filter, I don't see how would I use it.
_Yes, I can produce a... | Document how to customize the markdown_to_html converter | Closes #3842
Closes #3211
| afad02326d97efae1ff6bc3af828899fa10f3378 | 36cd35dff482d46242354faa1e137f43a0a34670 | diff --git a/doc/filters/markdown_to_html.rst b/doc/filters/markdown_to_html.rst
index 886cda4d40a..780f0112b96 100644
--- a/doc/filters/markdown_to_html.rst
+++ b/doc/filters/markdown_to_html.rst
@@ -77,3 +77,37 @@ You can also use the filter on an included file or a variable:
your Markdown library you can config... | [
"doc/filters/markdown_to_html.rst"
] | [] | true | |
twigphp/Twig | 3,889 | issue_to_patch | Add `Twiggy` extension for VS Code to docs. | e5d989fcfa9b11262dad32652b80a9ee0089adf6 | 81799a7461279c0e2ac9ca6805e1f7731290615e | diff --git a/doc/templates.rst b/doc/templates.rst
index c145895da0a..d70fdbbe458 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -59,7 +59,7 @@ Many IDEs support syntax highlighting and auto-completion for Twig:
* *Notepad++* via the `Notepad++ Twig Highlighter`_
* *Emacs* via `web-mode.el`_
* *Atom* via ... | [
"doc/templates.rst"
] | [] | true | |||
twigphp/Twig | 4,662 | issue_to_patch | CoreExtension::getAttribute: small improvement regarding getter/isser/hasser | For a getter method like `getFirstName` it is common to call it in twig via `person.firstName`.
But at the moment twig is adding these variants to the class method cache: `getFirstName`, `getfirstname`, `FirstName` and `firstname`.
So when resolving the name, it uses the first `elseif` here with additional `strtolow... | b1d2a9c20facd264edbe954284385b0924bdd923 | 45cd6ffe805f29bce2abd5b2e3d59b99cdd9a1d2 | diff --git a/src/Extension/CoreExtension.php b/src/Extension/CoreExtension.php
index f7e4250ae50..f78d4deb17c 100644
--- a/src/Extension/CoreExtension.php
+++ b/src/Extension/CoreExtension.php
@@ -1830,14 +1830,14 @@ public static function getAttribute(Environment $env, Source $source, $object, $
$clas... | [
"src/Extension/CoreExtension.php"
] | [
{
"comment": "[nitpick] Assigning `$length` inside the `substr` call is concise but can be hard to read. Consider setting `$length = 3;` on its own line before calling `substr` for clarity.",
"path": "src/Extension/CoreExtension.php",
"hunk": "@@ -1830,23 +1830,22 @@ public static function getAttribute(... | true | ||
twigphp/Twig | 4,662 | comment_to_fix | CoreExtension::getAttribute: small improvement regarding getter/isser/hasser | [nitpick] Assigning `$length` inside the `substr` call is concise but can be hard to read. Consider setting `$length = 3;` on its own line before calling `substr` for clarity. | b1d2a9c20facd264edbe954284385b0924bdd923 | 45cd6ffe805f29bce2abd5b2e3d59b99cdd9a1d2 | diff --git a/src/Extension/CoreExtension.php b/src/Extension/CoreExtension.php
index f7e4250ae50..f78d4deb17c 100644
--- a/src/Extension/CoreExtension.php
+++ b/src/Extension/CoreExtension.php
@@ -1830,14 +1830,14 @@ public static function getAttribute(Environment $env, Source $source, $object, $
$clas... | [
"src/Extension/CoreExtension.php"
] | [
{
"comment": "[nitpick] Assigning `$length` inside the `substr` call is concise but can be hard to read. Consider setting `$length = 3;` on its own line before calling `substr` for clarity.",
"path": "src/Extension/CoreExtension.php",
"hunk": "@@ -1830,23 +1830,22 @@ public static function getAttribute(... | true | ||
twigphp/Twig | 4,662 | comment_to_fix | CoreExtension::getAttribute: small improvement regarding getter/isser/hasser | [nitpick] This combines two operations (taking the first character and appending a substring) in one expression, which may be confusing. You might break this into two steps or add a comment explaining how the property name is reconstructed.
```suggestion
$firstChar = $lcName[0]; // Extract the first... | b1d2a9c20facd264edbe954284385b0924bdd923 | 45cd6ffe805f29bce2abd5b2e3d59b99cdd9a1d2 | diff --git a/src/Extension/CoreExtension.php b/src/Extension/CoreExtension.php
index f7e4250ae50..f78d4deb17c 100644
--- a/src/Extension/CoreExtension.php
+++ b/src/Extension/CoreExtension.php
@@ -1830,14 +1830,14 @@ public static function getAttribute(Environment $env, Source $source, $object, $
$clas... | [
"src/Extension/CoreExtension.php"
] | [
{
"comment": "[nitpick] This combines two operations (taking the first character and appending a substring) in one expression, which may be confusing. You might break this into two steps or add a comment explaining how the property name is reconstructed.\n```suggestion\n $firstChar = $lcName[... | true | ||
twigphp/Twig | 4,662 | comment_to_fix | CoreExtension::getAttribute: small improvement regarding getter/isser/hasser | This logic incorrectly constructs the camelCase name. It takes the first character from the lowercase name and appends the remainder from the original method name, which would result in incorrect casing. For example, 'getFirstName' would become 'firstrstName' instead of 'firstName'. The correct approach would be to low... | b1d2a9c20facd264edbe954284385b0924bdd923 | 45cd6ffe805f29bce2abd5b2e3d59b99cdd9a1d2 | diff --git a/src/Extension/CoreExtension.php b/src/Extension/CoreExtension.php
index f7e4250ae50..f78d4deb17c 100644
--- a/src/Extension/CoreExtension.php
+++ b/src/Extension/CoreExtension.php
@@ -1830,14 +1830,14 @@ public static function getAttribute(Environment $env, Source $source, $object, $
$clas... | [
"src/Extension/CoreExtension.php"
] | [
{
"comment": "This logic incorrectly constructs the camelCase name. It takes the first character from the lowercase name and appends the remainder from the original method name, which would result in incorrect casing. For example, 'getFirstName' would become 'firstrstName' instead of 'firstName'. The correct ap... | true | ||
twigphp/Twig | 4,825 | issue_to_patch | include() function must return a Markup object instead of a string
Hi everybody,
In a project, we have a node visitor altering the values of some template variables. We know if the value must be escaped or not thanks to the type: plain PHP string or `\Twig\Markup`
When setting a variable with a `set` tag "capturing"... | Make the include() function return a Markup object | Closes #4802 | ecf0ebf78bd0420ea40705d564b0c06890a72984 | a3eda4b1fd2162582903adef85dd8119995959ea | diff --git a/CHANGELOG b/CHANGELOG
index a266a8a49f5..443f4f0101b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@
* Stop reporting a skipped test in `IntegrationTestCase` when there is no legacy test to run
* Make the `IntegrationTestCase` and `NodeTestCase` test helpers compatible with PHPUnit 11
* Cast p... | [
"CHANGELOG",
"doc/functions/include.rst",
"src/Extension/CoreExtension.php",
"tests/Extension/CoreTest.php",
"tests/Extension/StringLoaderExtensionTest.php",
"tests/Fixtures/functions/include/assignment_autoescaping.test"
] | [] | diff --git a/tests/Extension/CoreTest.php b/tests/Extension/CoreTest.php
index ac8839369e1..faada348a55 100644
--- a/tests/Extension/CoreTest.php
+++ b/tests/Extension/CoreTest.php
@@ -29,6 +29,7 @@
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Loader\ArrayLoader;
+use Twig\Markup;
... | true |
twigphp/Twig | 4,830 | issue_to_patch | Strange behavior with block function inside parent block
Hello,
I found a strange behavior with all Twig versions.
```twig
{{ block('block1', 'theme.html.twig') }}`
{# theme.html.twig #}
{% extends 'base.html.twig' %}
{%- block block2 -%}
BLOCK2THEME/
{%- endblock -%}
{# base.html.twig #}
... | Fix nested block() resolution when a directly rendered block calls parent() | Closes #3321 | a0093cd699b790b6dcc6fa5438dbfb1e7662abe3 | 279fe13b224353fcfe3f1855d2d411eff38ec448 | diff --git a/CHANGELOG b/CHANGELOG
index 1d347b54217..a266a8a49f5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.27.2 (2026-XX-XX)
+ * Fix nested `block()` calls to resolve against the overriding template when a block rendered through `block(name, template)` calls `parent()`
* Stop reporting a skipped ... | [
"CHANGELOG",
"src/Template.php",
"tests/Fixtures/functions/block_with_template_parent.test"
] | [] | diff --git a/tests/Fixtures/functions/block_with_template_parent.test b/tests/Fixtures/functions/block_with_template_parent.test
new file mode 100644
index 00000000000..17a2698ead0
--- /dev/null
+++ b/tests/Fixtures/functions/block_with_template_parent.test
@@ -0,0 +1,28 @@
+--TEST--
+"block" function with a template a... | true |
twigphp/Twig | 4,824 | issue_to_patch | Improve error reporting in template render
We have a use case where we render templates that may contain data in array format and we use a filter to process that data when it is rendered.
If we forget the the filter, the template render throws "Array to string conversion" ErrorException in `Template.src#359`.
This Err... | Cast printed expressions to string so values that cannot be converted to a string (arrays, non-`Stringable` objects, ...) report a usable stack trace at the print location | Closes #4765
Closes #4780
Closes #4644
Is it what you had in mind @stof?
| 4cc1afe067a13a5db461fa335de63964f58d9360 | 89f886e324be41617958d9784d153f7fbf1a20ba | diff --git a/CHANGELOG b/CHANGELOG
index d2ce8156789..1dc3b49ae71 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
# 3.27.2 (2026-XX-XX)
* Make the `IntegrationTestCase` and `NodeTestCase` test helpers compatible with PHPUnit 11
+ * Cast printed expressions to string so values that cannot be converted to a s... | [
"CHANGELOG",
"src/Node/PrintNode.php",
"tests/Node/ForTest.php",
"tests/Node/IfTest.php",
"tests/Node/PrintTest.php",
"tests/TemplateTest.php"
] | [] | diff --git a/tests/Node/ForTest.php b/tests/Node/ForTest.php
index 2e33263e554..2fcf0fa7c04 100644
--- a/tests/Node/ForTest.php
+++ b/tests/Node/ForTest.php
@@ -73,7 +73,7 @@ public static function provideTests(): iterable
\$context['_parent'] = \$context;
\$context['_seq'] = CoreExtension::ensureTraversable($itemsGe... | true |
twigphp/Twig | 4,827 | issue_to_patch | Short spaceless-like operator
Replacing the usages of `spaceless` due to the deprecation, I was wondering what's the shortest way to remove spaces between two tags, and right now it seems to be `{#--#}`. I wonder if adding `{#-#}` as special operator for this would make sense? Or `{-}` even, I don't know. Just an idea... | Document {#--#} as the replacement for the deprecated spaceless filter | Closes #4442 | 1a2f2ea0a323cb6248742d3fad6f1cdc4be66c07 | c29877f54ab9aa6e35ecb338debf29b2f9589fa0 | diff --git a/doc/templates.rst b/doc/templates.rst
index 0b38d5bcc9c..9070c14c2ab 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -1299,6 +1299,18 @@ the modifiers on one side of a tag or on both sides:
{{~ value }} </li>
{# outputs '<li>\nno spaces </li>' #}
+To remove the whitespace be... | [
"doc/templates.rst"
] | [] | true | |
twigphp/Twig | 4,828 | issue_to_patch | Skipped test when using IntegrationTestCase with no legacy tests
When doing Twig tests extending `Twig\Test\IntegrationTestCase` there is a skipped test if no legacy tests are defined:
```
There was 1 skipped test:
1) MyTests\IntegrationTest::testLegacyIntegration with data set #0 ('not', '-', '', array(), '', array... | Stop reporting a skipped test in IntegrationTestCase when there is no legacy test to run | Closes #4635 | 1a2f2ea0a323cb6248742d3fad6f1cdc4be66c07 | 86076c87a671758fad769a10111bac66871d5bac | diff --git a/CHANGELOG b/CHANGELOG
index 1dc3b49ae71..1d347b54217 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.27.2 (2026-XX-XX)
+ * Stop reporting a skipped test in `IntegrationTestCase` when there is no legacy test to run
* Make the `IntegrationTestCase` and `NodeTestCase` test helpers compatible w... | [
"CHANGELOG",
"src/Test/IntegrationTestCase.php"
] | [] | diff --git a/src/Test/IntegrationTestCase.php b/src/Test/IntegrationTestCase.php
index c35ba8fe4a3..d4c5193719a 100644
--- a/src/Test/IntegrationTestCase.php
+++ b/src/Test/IntegrationTestCase.php
@@ -233,7 +233,10 @@ public function getLegacyTests()
protected function doIntegrationTest($file, $message, $condition... | true |
twigphp/Twig | 4,829 | issue_to_patch | add an example to the enum docs to demonstrate usage without repeating FQCN
Since the fully qualified class names (FQCN) may be pretty long, using enums may make the template hard to read IMHO. So it would be nice to adjust the [enum documentation](https://twig.symfony.com/doc/3.x/functions/enum.html) to give some mor... | Document storing an enum in a variable to avoid repeating its FQCN | Closes #4646 | 1a2f2ea0a323cb6248742d3fad6f1cdc4be66c07 | e1178abfa18bd95fd358a01bc293c33d8b812335 | diff --git a/doc/functions/enum.rst b/doc/functions/enum.rst
index 6fb9bb0093a..23d5f0c3c30 100644
--- a/doc/functions/enum.rst
+++ b/doc/functions/enum.rst
@@ -32,6 +32,15 @@
When using a string literal for the ``enum`` argument, it will be validated during compile time to be a valid enum name.
+As the FQCN can b... | [
"doc/functions/enum.rst"
] | [] | true | |
twigphp/Twig | 4,826 | issue_to_patch | PHPUnit support with 3.x
Projects using Twig and the provided PHPUnit test case classes (e.g. `IntegrationTestCase`) are blocked from upgrading to supported PHPUnit versions as these test case classes rely on behaviour that is no longer works in PHPUnit ≥ 11.
An issue resolved this problem for Twig 4.x https://github... | Make IntegrationTestCase and NodeTestCase compatible with PHPUnit 11 | Closes #4782 | 2a2f058f7050eb54710930bb6d86315e2f74de36 | 8a4b77920a8ef2c73078df72752e0ff12c0f9b4e | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9a76671f56a..e1c9c6103d8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -54,6 +54,51 @@ jobs:
- name: "Run tests"
run: vendor/bin/simple-phpunit
+ tests-phpunit-11:
+ name: "PHP ${{ ma... | [
".github/workflows/ci.yml",
"CHANGELOG",
"src/Test/IntegrationTestCase.php",
"src/Test/NodeTestCase.php",
"tests/Cache/ChainTest.php",
"tests/Cache/FilesystemTest.php",
"tests/Cache/ReadOnlyFilesystemTest.php",
"tests/CustomExtensionTest.php",
"tests/DeprecatedCallableInfoTest.php",
"tests/Environ... | [] | diff --git a/src/Test/IntegrationTestCase.php b/src/Test/IntegrationTestCase.php
index d995c6a032c..c35ba8fe4a3 100644
--- a/src/Test/IntegrationTestCase.php
+++ b/src/Test/IntegrationTestCase.php
@@ -11,6 +11,8 @@
namespace Twig\Test;
+use PHPUnit\Framework\Attributes\DataProvider;
+use PHPUnit\Framework\Attribut... | true |
twigphp/Twig | 4,823 | issue_to_patch | Skip the sandbox `__toString` check on arguments whose PHP parameter type cannot implicitly coerce to string | The sandbox visitor currently wraps every argument of every Twig callable with `CheckToStringNode.
As an optimization, we are now only wrapping when needed (based on the callable type hints). This is a conservative approach (untyped, mixed, string, array, iterable, object, Stringable, Traversable, self/static/parent... | 4e58cb22e5af2b8680854c377ec0ab6dfd901ea1 | 6d5ef30436dca7c9b7e769791cf2ca0bd67837d7 | diff --git a/CHANGELOG b/CHANGELOG
index 511ba747518..1ca2712c664 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
# 3.27.2 (2026-XX-XX)
- * n/a
+ * Skip the sandbox `__toString` check on arguments whose PHP parameter type cannot implicitly coerce to string
# 3.27.1 (2026-05-30)
diff --git a/src/Node/Expr... | [
"CHANGELOG",
"src/Node/Expression/CallExpression.php",
"src/NodeVisitor/SandboxNodeVisitor.php",
"src/Util/CallableArgumentsExtractor.php",
"src/Util/CallableParameters.php",
"src/Util/ReflectionCallable.php",
"tests/Extension/SandboxTest.php",
"tests/Util/CallableParametersTest.php"
] | [
{
"comment": "`self` and `parent` should be resolved to the actual class name, and be subject to the same logic than the class name. And `static` should probably be handled that way as well (probably treating it like `self` in this case).",
"path": "src/Util/CallableParameters.php",
"hunk": "@@ -0,0 +1,... | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index de6594b6d4b..25b71f6ce78 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -1409,6 +1409,228 @@ public function testSandboxStillBlocksDisallowedToStringInTraversableArgument()
}
}
+ ... | true | |
twigphp/Twig | 4,823 | comment_to_fix | Skip the sandbox `__toString` check on arguments whose PHP parameter type cannot implicitly coerce to string | `self` and `parent` should be resolved to the actual class name, and be subject to the same logic than the class name. And `static` should probably be handled that way as well (probably treating it like `self` in this case). | 4e58cb22e5af2b8680854c377ec0ab6dfd901ea1 | 6d5ef30436dca7c9b7e769791cf2ca0bd67837d7 | diff --git a/src/Util/CallableParameters.php b/src/Util/CallableParameters.php
new file mode 100644
index 00000000000..4321bb2915c
--- /dev/null
+++ b/src/Util/CallableParameters.php
@@ -0,0 +1,161 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) Fabien Potencier
+ *
+ * For the full copyright and license inf... | [
"src/Util/CallableParameters.php"
] | [
{
"comment": "`self` and `parent` should be resolved to the actual class name, and be subject to the same logic than the class name. And `static` should probably be handled that way as well (probably treating it like `self` in this case).",
"path": "src/Util/CallableParameters.php",
"hunk": "@@ -0,0 +1,... | true | ||
twigphp/Twig | 4,823 | comment_to_fix | Skip the sandbox `__toString` check on arguments whose PHP parameter type cannot implicitly coerce to string | Enums should be considered safe, as they cannot be stringable. | 4e58cb22e5af2b8680854c377ec0ab6dfd901ea1 | 6d5ef30436dca7c9b7e769791cf2ca0bd67837d7 | diff --git a/src/Util/CallableParameters.php b/src/Util/CallableParameters.php
new file mode 100644
index 00000000000..4321bb2915c
--- /dev/null
+++ b/src/Util/CallableParameters.php
@@ -0,0 +1,161 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) Fabien Potencier
+ *
+ * For the full copyright and license inf... | [
"src/Util/CallableParameters.php"
] | [
{
"comment": "Enums should be considered safe, as they cannot be stringable.",
"path": "src/Util/CallableParameters.php",
"hunk": "@@ -0,0 +1,143 @@\n+<?php\n+\n+/*\n+ * This file is part of Twig.\n+ *\n+ * (c) Fabien Potencier\n+ *\n+ * For the full copyright and license information, please view the LI... | true | ||
twigphp/Twig | 4,823 | comment_to_fix | Skip the sandbox `__toString` check on arguments whose PHP parameter type cannot implicitly coerce to string | Due to the definition of "safe" for object types (a final class that is not stringable nor traversable), an intersection type is actually safe if it contains a safe type. | 4e58cb22e5af2b8680854c377ec0ab6dfd901ea1 | 6d5ef30436dca7c9b7e769791cf2ca0bd67837d7 | diff --git a/src/Util/CallableParameters.php b/src/Util/CallableParameters.php
new file mode 100644
index 00000000000..4321bb2915c
--- /dev/null
+++ b/src/Util/CallableParameters.php
@@ -0,0 +1,161 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) Fabien Potencier
+ *
+ * For the full copyright and license inf... | [
"src/Util/CallableParameters.php"
] | [
{
"comment": "Due to the definition of \"safe\" for object types (a final class that is not stringable nor traversable), an intersection type is actually safe if it contains a safe type.",
"path": "src/Util/CallableParameters.php",
"hunk": "@@ -0,0 +1,153 @@\n+<?php\n+\n+/*\n+ * This file is part of Twi... | true | ||
twigphp/Twig | 4,823 | comment_to_fix | Skip the sandbox `__toString` check on arguments whose PHP parameter type cannot implicitly coerce to string | Why not letting this be handled in the `$type->isBuiltin()` case below ? It is also a builtin type. | 4e58cb22e5af2b8680854c377ec0ab6dfd901ea1 | 6d5ef30436dca7c9b7e769791cf2ca0bd67837d7 | diff --git a/src/Util/CallableParameters.php b/src/Util/CallableParameters.php
new file mode 100644
index 00000000000..4321bb2915c
--- /dev/null
+++ b/src/Util/CallableParameters.php
@@ -0,0 +1,161 @@
+<?php
+
+/*
+ * This file is part of Twig.
+ *
+ * (c) Fabien Potencier
+ *
+ * For the full copyright and license inf... | [
"src/Util/CallableParameters.php"
] | [
{
"comment": "Why not letting this be handled in the `$type->isBuiltin()` case below ? It is also a builtin type.",
"path": "src/Util/CallableParameters.php",
"hunk": "@@ -0,0 +1,153 @@\n+<?php\n+\n+/*\n+ * This file is part of Twig.\n+ *\n+ * (c) Fabien Potencier\n+ *\n+ * For the full copyright and li... | true | ||
twigphp/Twig | 4,822 | issue_to_patch | \Stringable when strict_variables: true silently becomes string in array key. When strict_variables: false exception thrown
Try following template (test.twig):
`{{ array[object] }}`
For context:
```
$object = new class implements \Stringable {
public function __toString()
{
return 'string';
}
};
... | Fix inconsistent array access with a Stringable key | Closes #4804 | dfb5232d51248d82726c25effe5ef7c64c5b2b6d | 8ec953073281638c4b809adb3b70a3157c9ff343 | diff --git a/CHANGELOG b/CHANGELOG
index 174b8e237a2..bf8436801d7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.27.1 (2026-XX-XX)
+ * Fix array access with a `Stringable` key to coerce the key to string consistently instead of throwing in the optimized path
* Fix sandbox replacing `IteratorAggregate` ... | [
"CHANGELOG",
"src/Node/Expression/GetAttrExpression.php",
"tests/TemplateTest.php"
] | [] | diff --git a/tests/TemplateTest.php b/tests/TemplateTest.php
index 7102db9a72b..dcd8b406048 100644
--- a/tests/TemplateTest.php
+++ b/tests/TemplateTest.php
@@ -252,6 +252,58 @@ public function testGetAttributeOnArrayWithConfusableKey()
$this->assertSame('EmptyString', CoreExtension::getAttribute($twig, $templ... | true |
twigphp/Twig | 4,821 | issue_to_patch | Sandbox mode form_errors exception
Hi everybody,
With the release of twig 3.27.0 `form_errors()` is broken in the sandbox environment when you pass it a `Symfony\Component\Form\FormView`.
`An exception has been thrown during the rendering of a template ("Symfony\Component\Form\FormRenderer::searchAndRenderBlock(): A... | Preserve IteratorAggregate identity in sandbox __toString walker | Fixes #4820
It's not a full fix, but a quick one just that for the specific use case described in the issue. This is the simple case as IteratorAggregate instances can be iterated more than once (I suppose most such iterators don't have side effects).
| 118938b191b039c2f064cb9e8a3cc89b78ac9504 | d25f98f45b5a0928bedd82232817bd439f7711a1 | diff --git a/CHANGELOG b/CHANGELOG
index 3848c2198ce..174b8e237a2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
# 3.27.1 (2026-XX-XX)
- * n/a
+ * Fix sandbox replacing `IteratorAggregate` arguments (e.g. Symfony's `FormView`) by a plain array
# 3.27.0 (2026-05-27)
diff --git a/src/Extension/SandboxExte... | [
"CHANGELOG",
"src/Extension/SandboxExtension.php",
"tests/Extension/SandboxTest.php"
] | [] | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index ddb6ce79adb..de6594b6d4b 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -1355,6 +1355,60 @@ public function enableSandbox(Source $source): bool
}
}
+ public function testSandbox... | true |
twigphp/Twig | 4,817 | issue_to_patch | Add a strict mode to SecurityPolicy to opt-in to the 4.0 sandbox behavior for the extends/use tags and the parent/block/attribute functions | #4813 follow-up
As @stof mentioned on Slack, there is currently no way to avoid the deprecation if you want to forbid those tags.
| 4dde307c32ad8e1d1832a91de5bcaa9d0677501f | af7bf5e181204982ba52325843eb219b91928ba6 | diff --git a/CHANGELOG b/CHANGELOG
index 400ab7413c3..3adfc537909 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.27.0 (2026-XX-XX)
+ * Add a strict mode to `Twig\Sandbox\SecurityPolicy` to opt-in to the 4.0 behavior for the `extends`/`use` tags and the `parent`/`block`/`attribute` functions, which are ot... | [
"CHANGELOG",
"doc/deprecated.rst",
"doc/sandbox.rst",
"src/Sandbox/SecurityPolicy.php",
"tests/Extension/SandboxTest.php"
] | [] | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index 97236cf86a4..716dd5f80a2 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -135,7 +135,7 @@ public static function getSandboxedForCoreTagsTests()
*/
public function testSandboxForExtendsAn... | true | |
twigphp/Twig | 4,815 | issue_to_patch | Document transitive behavior of allowed sandbox operations | 3b0808f455cb52bbc652bdf9f507f1f1c7cecd17 | 461143d70001b2dc60101ab3ecb9b8f99ed4d441 | diff --git a/doc/sandbox.rst b/doc/sandbox.rst
index 4cb604b3466..f2d9d39448f 100644
--- a/doc/sandbox.rst
+++ b/doc/sandbox.rst
@@ -68,6 +68,27 @@ the extension constructor::
$twig->addExtension(new \Twig\Extension\SandboxExtension($policy, true));
+Allowed Operations Apply Transitively to Their Arguments
+--... | [
"doc/sandbox.rst"
] | [] | true | |||
twigphp/Twig | 4,814 | issue_to_patch | Remove obsolete PHP 8.0 workaround for Closure::__invoke attribute access | The removed code was needed for `isset($closure->__invoke)` to work with PHP pre-8.0 (to avoid a fatal error):
* 7.4: Fatal error: Uncaught Error: Closure object cannot have properties
* 8.0: Fatal error: Uncaught Error: Closure object cannot have properties
* 8.1+: bool(false) clean, no error
| 89e79c28f1e3ecd9d6f30214185bee3a893c12f8 | 42ccc472a290d23bd970333d44b720b61be0b730 | diff --git a/src/Extension/CoreExtension.php b/src/Extension/CoreExtension.php
index 17c0054b728..f150ca71f12 100644
--- a/src/Extension/CoreExtension.php
+++ b/src/Extension/CoreExtension.php
@@ -1795,10 +1795,6 @@ public static function getAttribute(Environment $env, Source $source, $object, $
static $... | [
"src/Extension/CoreExtension.php"
] | [] | true | ||
twigphp/Twig | 4,813 | issue_to_patch | Deprecate the fact that the `parent`, `block`, and `attribute` functions are always allowed in a sandboxed template | d0a5017fd5b0c9a7850a45d1e45a6154d3534cf9 | cfaa2fd030fc35b9e7e99a863ab0021204334d04 | diff --git a/CHANGELOG b/CHANGELOG
index d145b5fa383..400ab7413c3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.27.0 (2026-XX-XX)
+ * Deprecate the fact that the `parent`, `block`, and `attribute` functions are always allowed in a sandboxed template
* Fix PHP 8.1+ implicit float-to-int deprecation tri... | [
"CHANGELOG",
"doc/deprecated.rst",
"src/ExpressionParser/Infix/FunctionExpressionParser.php",
"src/NodeVisitor/SandboxNodeVisitor.php",
"src/Sandbox/SecurityPolicy.php",
"tests/Extension/SandboxTest.php"
] | [] | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index 694ab4a0b34..97236cf86a4 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -147,6 +147,107 @@ public static function getSandboxedForExtendsAndUseTagsTests()
yield ['use', '{% use "1_empty" %... | true | ||
twigphp/Twig | 4,812 | issue_to_patch | Fix PHP 8.1+ implicit float-to-int deprecation in sandboxed array access | 12f0dc2a1e249eac6e48870f2945f37c3a418a00 | 33690a4a28756ea5aeb43aa76b9949fe6b4d3ac9 | diff --git a/CHANGELOG b/CHANGELOG
index 50cacca5254..d145b5fa383 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.27.0 (2026-XX-XX)
+ * Fix PHP 8.1+ implicit float-to-int deprecation triggered by sandboxed `ArrayAccess` attribute access with a float key
* Restrict allowed classes in `Twig\Profiler\Profi... | [
"CHANGELOG",
"src/Extension/CoreExtension.php",
"tests/Extension/SandboxTest.php"
] | [] | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index bd6aff53e35..694ab4a0b34 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -191,6 +191,64 @@ public function testSandboxUnallowedArrayIndexAccessor()
}
}
+ /**
+ * @dataProvide... | true | ||
twigphp/Twig | 4,811 | issue_to_patch | Set LANG=en_US.UTF-8 for the extra packages tests | ee8e1b8651806d9b1a7baaa5f16511d3204ab03d | d016d2439f59d337a35d27ea8b617805bd8ee922 | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 06f41dfcb3c..9a76671f56a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -122,6 +122,12 @@ jobs:
- name: "Run tests for ${{ matrix.extension }}"
working-directory: extra/${{ matrix.extension }}
+... | [
".github/workflows/ci.yml"
] | [] | true | |||
twigphp/Twig | 4,810 | issue_to_patch | Use modern PHPUnit for extra packages | 85013f01b33a346290f0e9e637cdd3333c4cf909 | 25d7eb60d7cf73a5fda4064b2e97ae6d7191544f | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 43f60bf3bca..06f41dfcb3c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -64,6 +64,9 @@ jobs:
continue-on-error: true
+ env:
+ SYMFONY_PHPUNIT_VERSION: ${{ matrix.php-version == '8.1' && '9.6' |... | [
".github/workflows/ci.yml",
"extra/twig-extra-bundle/phpunit-bootstrap.php",
"extra/twig-extra-bundle/phpunit.xml.dist"
] | [] | true | |||
twigphp/Twig | 4,809 | issue_to_patch | Simplify code | fe6cbf9fcb8ef6de9b0761c8fdcabf1ae39c353d | 49e59e46122bdf130e792a187629e121e5e0e862 | diff --git a/src/Node/CheckSecurityNode.php b/src/Node/CheckSecurityNode.php
index 6e591aad40a..9f2c7532418 100644
--- a/src/Node/CheckSecurityNode.php
+++ b/src/Node/CheckSecurityNode.php
@@ -52,9 +52,9 @@ public function compile(Compiler $compiler): void
->indent()
->write("\$this->sandbox->... | [
"src/Node/CheckSecurityNode.php"
] | [] | true | |||
twigphp/Twig | 4,807 | issue_to_patch | Escape root profile name in HtmlDumper | ead63cc8246dbb10f50817abece34e351694fd3f | f6aca309d8461bca2ffbacf151a2a6c6d58f9879 | diff --git a/CHANGELOG b/CHANGELOG
index c69e46f10e2..50cacca5254 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
# 3.27.0 (2026-XX-XX)
* Restrict allowed classes in `Twig\Profiler\Profile::unserialize()` to prevent arbitrary class instantiation
+ * Escape root profile name in `HtmlDumper`
* Deprecate the... | [
"CHANGELOG",
"src/Profiler/Dumper/BaseDumper.php",
"src/Profiler/Dumper/HtmlDumper.php",
"tests/Profiler/Dumper/HtmlTest.php"
] | [] | diff --git a/tests/Profiler/Dumper/HtmlTest.php b/tests/Profiler/Dumper/HtmlTest.php
index b1170a83a39..75ddb791d5f 100644
--- a/tests/Profiler/Dumper/HtmlTest.php
+++ b/tests/Profiler/Dumper/HtmlTest.php
@@ -59,4 +59,14 @@ public function testDumpEscapesTemplateAndProfileNames()
$this->assertStringContainsStr... | true | ||
twigphp/Twig | 4,808 | issue_to_patch | Restrict allowed classes in Profile::unserialize() | c6bbae295b79d01ff47dc211e9846b20b29f1bc3 | 4c1dae5e715bbe58128aeaac5abf0f96c31476c4 | diff --git a/CHANGELOG b/CHANGELOG
index 2995a21c17e..c69e46f10e2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.27.0 (2026-XX-XX)
+ * Restrict allowed classes in `Twig\Profiler\Profile::unserialize()` to prevent arbitrary class instantiation
* Deprecate the `Twig\Sandbox\SourcePolicyInterface` interfa... | [
"CHANGELOG",
"src/Profiler/Profile.php",
"tests/Profiler/ProfileTest.php"
] | [] | diff --git a/tests/Profiler/ProfileTest.php b/tests/Profiler/ProfileTest.php
index 27e013fc6d5..5a5e8871f30 100644
--- a/tests/Profiler/ProfileTest.php
+++ b/tests/Profiler/ProfileTest.php
@@ -121,6 +121,23 @@ public function testSerialize()
$this->assertEquals($profile1->getName(), $profile3->getName());
... | true | ||
twigphp/Twig | 4,803 | issue_to_patch | Deprecate the "Twig\Sandbox\SourcePolicyInterface" interface | I'm deprecating this feature for the following main reasons:
* AFAICS, no open-source projects is using this feature and the only repository using it has 0 stars and 0 downloads on Packagist - if nobody find value in this feature, it's better to remove it
* As much as possible, a better strategy is to render templa... | af86a386bfad8aa807bc1a83368b60d61563daf9 | bd924d5d33c0fddebf53edf1e6e2afd9d0ee17f7 | diff --git a/CHANGELOG b/CHANGELOG
index cc000d55663..07baad84b6a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
# 3.26.1 (2026-XX-XX)
- * n/a
+ * Deprecate the `Twig\Sandbox\SourcePolicyInterface` interface with no replacement
# 3.26.0 (2026-05-20)
diff --git a/doc/deprecated.rst b/doc/deprecated.rst
i... | [
"CHANGELOG",
"doc/deprecated.rst",
"src/Extension/SandboxExtension.php",
"src/Sandbox/SourcePolicyInterface.php",
"tests/Extension/SandboxTest.php"
] | [] | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index a5c9dad37a4..c78bfc6c1a4 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -932,8 +932,13 @@ protected function getEnvironment($sandboxed, $options, $templates, $tags = [],
return $twig;
... | true | |
twigphp/Twig | 4,806 | issue_to_patch | Remove Drupal integration tests | fb3ca5e08972185f32494ad546b37f230be93253 | 0a80d1a9aa6c0b16063c1070327913e5258d3131 | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cad60c963ef..43f60bf3bca 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -122,37 +122,6 @@ jobs:
working-directory: extra/${{ matrix.extension }}
run: ../../vendor/bin/simple-phpunit
- integ... | [
".github/workflows/ci.yml",
"tests/drupal_test.sh"
] | [] | diff --git a/tests/drupal_test.sh b/tests/drupal_test.sh
deleted file mode 100644
index eff75f2495e..00000000000
--- a/tests/drupal_test.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-
-set -x
-set -e
-
-REPO=`pwd`
-cd /tmp
-rm -rf drupal-twig-test
-composer create-project --no-interaction drupal/recommended-project:1... | true | ||
twigphp/Twig | 4,805 | issue_to_patch | Replace FQCN with use statements in SandboxTest | 4a64b5b486b3795dbc62df81241bde3891e83bc8 | d8781e473c1b255bd28e89d1ea9fe343bd9f47bd | diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index 4753446ed3f..3b30644bdd0 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -8,18 +8,37 @@
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
- '@PHPUnit75Migration:risky' => true,
+ '@PHPUni... | [
".php-cs-fixer.dist.php",
"tests/Extension/SandboxTest.php"
] | [] | diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php
index c2b45144771..a5c9dad37a4 100644
--- a/tests/Extension/SandboxTest.php
+++ b/tests/Extension/SandboxTest.php
@@ -28,6 +28,7 @@
use Twig\Extension\SandboxExtension;
use Twig\Extension\StringLoaderExtension;
use Twig\Loader\ArrayLoader... | true | ||
twigphp/Twig | 4,795 | issue_to_patch | Lazy load `EscaperRuntime` in `EscaperExtension` | This allows overriding `EscaperRuntime` via a custom runtime loader.
Previously, `EscaperExtension::setEnvironment()` was calling `$environment->getRuntime(EscaperRuntime::class)` eagerly. Since this method is called from `Environment::__construct()`, the runtime was resolved before any custom runtime loader could b... | ecb310e129f549daa3424f6565520bcc807d16f3 | b73ab8cfd9821ac6e99c2a2abc796d4ae608beed | diff --git a/src/Extension/EscaperExtension.php b/src/Extension/EscaperExtension.php
index c5625fa6a41..6d9d1ce24d3 100644
--- a/src/Extension/EscaperExtension.php
+++ b/src/Extension/EscaperExtension.php
@@ -76,7 +76,7 @@ public function setEnvironment(Environment $environment): void
}
$this->envir... | [
"src/Extension/EscaperExtension.php",
"tests/Extension/EscaperTest.php"
] | [] | diff --git a/tests/Extension/EscaperTest.php b/tests/Extension/EscaperTest.php
index 52f06950c9f..09aa4ca7935 100644
--- a/tests/Extension/EscaperTest.php
+++ b/tests/Extension/EscaperTest.php
@@ -25,6 +25,7 @@
use Twig\Extension\EscaperExtension;
use Twig\Loader\ArrayLoader;
use Twig\Runtime\EscaperRuntime;
+use Tw... | true | |
twigphp/Twig | 4,800 | issue_to_patch | Add a `needs_is_sandboxed` option for filters, functions, and tests | This PR introduces a new `needs_is_sandboxed` option for Twig callables.
When set to `true`, Twig passes the current sandbox state (enabled/disabled) as a boolean to the callable. This lets filters, functions, and tests adapt their behavior depending on whether the sandbox is enabled or not.
| c3f37a519534b143ad318cbf8c9914ed0116f1ba | 5462817da0d6065f087171e6b9caed5eaf236d61 | diff --git a/CHANGELOG b/CHANGELOG
index 03a5af5fbc9..4a255b8a830 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
# 3.25.0 (2026-XX-XX)
+ * Add a `needs_is_sandboxed` option for filters, functions, and tests
* Use deterministic suffixes for generated embed classes
# 3.24.0 (2026-03-17)
diff --git a/doc/a... | [
"CHANGELOG",
"doc/advanced.rst",
"src/AbstractTwigCallable.php",
"src/Attribute/AsTwigFilter.php",
"src/Attribute/AsTwigFunction.php",
"src/Attribute/AsTwigTest.php",
"src/Extension/AttributeExtension.php",
"src/Node/Expression/CallExpression.php",
"src/TwigCallableInterface.php",
"src/Util/Callab... | [] | diff --git a/tests/Extension/AttributeExtensionTest.php b/tests/Extension/AttributeExtensionTest.php
index 273ac2c24b2..41b215c3042 100644
--- a/tests/Extension/AttributeExtensionTest.php
+++ b/tests/Extension/AttributeExtensionTest.php
@@ -48,6 +48,7 @@ public static function provideFilters()
yield 'with env'... | true | |
twigphp/Twig | 4,797 | issue_to_patch | Make embeds deterministic | Using `{% embed 'foo.twig' %}...{% endembed %}` makes compiled templates non-deterministic. This poses a problem for developers who wish to provide reproducible, pre-compiled builds of Twig templates.
The cause is `mt_rand()` used to generate template indices. The change I propose uses an incrementing counter instea... | ab8dd4aaddae11b63af41d531423b0d4e8e81248 | 2b4aa4458a1d40a7e0325b5f7c993a0b7aae0719 | diff --git a/CHANGELOG b/CHANGELOG
index 0eb1aacba88..03a5af5fbc9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
-# 3.24.1 (2026-XX-XX)
+# 3.25.0 (2026-XX-XX)
- * n/a
+ * Use deterministic suffixes for generated embed classes
# 3.24.0 (2026-03-17)
diff --git a/doc/templates.rst b/doc/templates.rst
index ... | [
"CHANGELOG",
"doc/templates.rst",
"src/Parser.php",
"tests/ParserTest.php"
] | [
{
"comment": "I would always unset it so that it is not stored in the stack, and then doing `if (!$this->stack) { $this->nextEmbedIndex = 1; }`. It will provide the same result by with clearer code IMO.",
"path": "src/Parser.php",
"hunk": "@@ -83,6 +84,12 @@ public function parse(TokenStream $stream, $t... | diff --git a/tests/ParserTest.php b/tests/ParserTest.php
index d578ed9e1f6..37c468e8855 100644
--- a/tests/ParserTest.php
+++ b/tests/ParserTest.php
@@ -206,6 +206,20 @@ public function testImplicitMacroArgumentDefaultValues()
$this->assertTrue($argumentNodes->getNode(3)->getAttribute('value'));
}
+ ... | true | |
twigphp/Twig | 4,797 | comment_to_fix | Make embeds deterministic | I would always unset it so that it is not stored in the stack, and then doing `if (!$this->stack) { $this->nextEmbedIndex = 1; }`. It will provide the same result by with clearer code IMO. | ab8dd4aaddae11b63af41d531423b0d4e8e81248 | 2b4aa4458a1d40a7e0325b5f7c993a0b7aae0719 | diff --git a/src/Parser.php b/src/Parser.php
index 3553007a95e..62f14ebf5fd 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -54,6 +54,7 @@ class Parser
private $importedSymbols;
private $traits;
private $embeddedTemplates = [];
+ private int $lastEmbedIndex = 0;
private $varNameSalt = 0;
... | [
"src/Parser.php"
] | [
{
"comment": "I would always unset it so that it is not stored in the stack, and then doing `if (!$this->stack) { $this->nextEmbedIndex = 1; }`. It will provide the same result by with clearer code IMO.",
"path": "src/Parser.php",
"hunk": "@@ -83,6 +84,12 @@ public function parse(TokenStream $stream, $t... | true | ||
twigphp/Twig | 4,797 | comment_to_fix | Make embeds deterministic | I would rather do that at the beginning of the method than at the end, to be safer in case some exception happens and the parser is reused later. | ab8dd4aaddae11b63af41d531423b0d4e8e81248 | 2b4aa4458a1d40a7e0325b5f7c993a0b7aae0719 | diff --git a/src/Parser.php b/src/Parser.php
index 3553007a95e..62f14ebf5fd 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -54,6 +54,7 @@ class Parser
private $importedSymbols;
private $traits;
private $embeddedTemplates = [];
+ private int $lastEmbedIndex = 0;
private $varNameSalt = 0;
... | [
"src/Parser.php"
] | [
{
"comment": "I would rather do that at the beginning of the method than at the end, to be safer in case some exception happens and the parser is reused later.",
"path": "src/Parser.php",
"hunk": "@@ -142,6 +143,11 @@ public function parse(TokenStream $stream, $test = null, bool $dropNeedle = fals\n ... | true | ||
twigphp/Twig | 4,797 | comment_to_fix | Make embeds deterministic | ```suggestion
// reset on root parse() calls only, so the counter spans nested/reentrant parses
``` | ab8dd4aaddae11b63af41d531423b0d4e8e81248 | 2b4aa4458a1d40a7e0325b5f7c993a0b7aae0719 | diff --git a/src/Parser.php b/src/Parser.php
index 3553007a95e..62f14ebf5fd 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -54,6 +54,7 @@ class Parser
private $importedSymbols;
private $traits;
private $embeddedTemplates = [];
+ private int $lastEmbedIndex = 0;
private $varNameSalt = 0;
... | [
"src/Parser.php"
] | [
{
"comment": "```suggestion\n // reset on root parse() calls only, so the counter spans nested/reentrant parses\n```",
"path": "src/Parser.php",
"hunk": "@@ -81,8 +82,13 @@ public function getVarName(): string\n */\n public function parse(TokenStream $stream, $test = null, bool $dropNeed... | true | ||
twigphp/Twig | 4,797 | comment_to_fix | Make embeds deterministic | ```suggestion
$template->setIndex(++$this->nextEmbedIndex);
``` | ab8dd4aaddae11b63af41d531423b0d4e8e81248 | 2b4aa4458a1d40a7e0325b5f7c993a0b7aae0719 | diff --git a/src/Parser.php b/src/Parser.php
index 3553007a95e..62f14ebf5fd 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -54,6 +54,7 @@ class Parser
private $importedSymbols;
private $traits;
private $embeddedTemplates = [];
+ private int $lastEmbedIndex = 0;
private $varNameSalt = 0;
... | [
"src/Parser.php"
] | [
{
"comment": "```suggestion\n $template->setIndex(++$this->nextEmbedIndex);\n```",
"path": "src/Parser.php",
"hunk": "@@ -319,7 +325,7 @@ public function hasTraits(): bool\n */\n public function embedTemplate(ModuleNode $template)\n {\n- $template->setIndex(mt_rand());\n+ ... | true | ||
twigphp/Twig | 4,799 | issue_to_patch | Unexpected behavior of the ‘in’ operator
### What
I expect `false` to return, but `true` returns.
### How to reproduce
tested with twig/twig 3.21.1
```
{% set fooBar = {0: 'foo', 1: 'bar'} %}
{{ dump( true in fooBar, false in fooBar, 0 in fooBar, 1 in fooBar ) }}
```
Will return: `true` , `false`, `false`, `fal... | [Doc] Document loose comparison in the `in` operator | Clarifies the comparison semantics of the `in` operator in the *Containment Operators* section of `doc/templates.rst`:
- `in` uses a loose comparison (similar to `==`) for sequences, mappings, and `Traversable` objects, like PHP's `in_array()`.
- Pointer to `same as` for strict comparisons.
- Warning about boolean lef... | 99d95dd6b8b0cc3c2397d15d45a4bb87eff89ddc | 8af8e93970468ca5d80d9f253ab478446410ca4e | diff --git a/doc/templates.rst b/doc/templates.rst
index 279c1b832f8..23fbb6a588d 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -794,6 +794,21 @@ operand is contained in the right:
You can use this operator to perform a containment test on strings,
sequences, mappings, or objects implementing the ... | [
"doc/templates.rst"
] | [] | true | |
twigphp/Twig | 4,798 | issue_to_patch | The counter intuitive removal of first newline immediately after the regular comment closing #}
The doc/templates.rst states: "... default removal of the first newline inherited from PHP".
What are you talking about? Where PHP removes the first newline? I cannot google up anything like such a newline removal of PH... | [Doc] Reword whitespace control note about first-newline removal | Fixes #4720.
The wording on line 1224 of `doc/templates.rst` ("removal of the first newline **inherited from PHP**") was misleading — Twig does not inherit anything from PHP, it deliberately implements the same behavior (just like Jinja does, which uses *"like in PHP"* in its own documentation).
The note already exis... | 99d95dd6b8b0cc3c2397d15d45a4bb87eff89ddc | 6904b23fb6e139608477d1d24ad8e8efe06041a5 | diff --git a/doc/templates.rst b/doc/templates.rst
index 279c1b832f8..9fec7c20414 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -1221,7 +1221,7 @@ Twig supports two modifiers:
* *Line whitespace trimming* via the ``~`` modifier: Removes all whitespace
(excluding newlines). Using this modifier on the r... | [
"doc/templates.rst"
] | [] | true | |
twigphp/Twig | 4,004 | issue_to_patch | [Doc] Correct Order & Explanation on precedence | Following this [issue](https://github.com/twigphp/Twig/issues/3714), i worked on it trying to make it simple and easy to understand
Indeed order of the precedence was not good for ``b-and``, ``b-xor`` and ``b-and``.
Code [here ](https://github.com/twigphp/Twig/blob/3.x/src/Extension/CoreExtension.php#L280) to und... | f67ad6c8a473eeddc16c7e1750aab535dfe294dd | 01e0b7ce4281529078adf5e20a78a48b8ae55831 | diff --git a/doc/templates.rst b/doc/templates.rst
index 0486c52e3c7..c80285e90fc 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -514,13 +514,40 @@ Twig allows expressions everywhere.
.. note::
+ Twig uses operators to perform various operations within templates. Understanding
+ the precedence of ... | [
"doc/templates.rst"
] | [
{
"comment": "What about ``?:`` .. ? :) ",
"path": "doc/templates.rst",
"hunk": "@@ -514,13 +514,41 @@ Twig allows expressions everywhere.\n \n .. note::\n \n+ Twig uses operators to perform various operations within templates. Understanding\n+ the precedence of these operators is crucial for wri... | true | ||
twigphp/Twig | 4,004 | comment_to_fix | [Doc] Correct Order & Explanation on precedence | What about ``?:`` .. ? :) | f67ad6c8a473eeddc16c7e1750aab535dfe294dd | 01e0b7ce4281529078adf5e20a78a48b8ae55831 | diff --git a/doc/templates.rst b/doc/templates.rst
index 0486c52e3c7..c80285e90fc 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -514,13 +514,40 @@ Twig allows expressions everywhere.
.. note::
+ Twig uses operators to perform various operations within templates. Understanding
+ the precedence of ... | [
"doc/templates.rst"
] | [
{
"comment": "What about ``?:`` .. ? :) ",
"path": "doc/templates.rst",
"hunk": "@@ -514,13 +514,41 @@ Twig allows expressions everywhere.\n \n .. note::\n \n+ Twig uses operators to perform various operations within templates. Understanding\n+ the precedence of these operators is crucial for wri... | true | ||
twigphp/Twig | 4,004 | comment_to_fix | [Doc] Correct Order & Explanation on precedence | Highest precedence means they come first, not last.
(You can see this behavior using following snippet: `{{"a" ~ "b" | upper}}`).
So, a better description might be `Filters are evaluated first.` | f67ad6c8a473eeddc16c7e1750aab535dfe294dd | 01e0b7ce4281529078adf5e20a78a48b8ae55831 | diff --git a/doc/templates.rst b/doc/templates.rst
index 0486c52e3c7..c80285e90fc 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -514,13 +514,40 @@ Twig allows expressions everywhere.
.. note::
+ Twig uses operators to perform various operations within templates. Understanding
+ the precedence of ... | [
"doc/templates.rst"
] | [
{
"comment": "Highest precedence means they come first, not last.\r\n(You can see this behavior using following snippet: `{{\"a\" ~ \"b\" | upper}}`).\r\n\r\nSo, a better description might be `Filters are evaluated first.`",
"path": "doc/templates.rst",
"hunk": "@@ -514,13 +514,41 @@ Twig allows express... | true | ||
twigphp/Twig | 4,004 | comment_to_fix | [Doc] Correct Order & Explanation on precedence | There might be something off with the markup, the table does not render when using the "rich diff" option in GitHub. Though, perhaps this is only a limitation of GitHub? | f67ad6c8a473eeddc16c7e1750aab535dfe294dd | 01e0b7ce4281529078adf5e20a78a48b8ae55831 | diff --git a/doc/templates.rst b/doc/templates.rst
index 0486c52e3c7..c80285e90fc 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -514,13 +514,40 @@ Twig allows expressions everywhere.
.. note::
+ Twig uses operators to perform various operations within templates. Understanding
+ the precedence of ... | [
"doc/templates.rst"
] | [
{
"comment": "There might be something off with the markup, the table does not render when using the \"rich diff\" option in GitHub. Though, perhaps this is only a limitation of GitHub?",
"path": "doc/templates.rst",
"hunk": "@@ -514,13 +514,41 @@ Twig allows expressions everywhere.\n \n .. note::\n \n+... | true | ||
twigphp/Twig | 4,004 | comment_to_fix | [Doc] Correct Order & Explanation on precedence | This part should not be marked as twig code block.
Rather, inline code is more appropriate:
```
This means that ``{{ 6 b-and 2 or 6 b-and 16 }}`` results in ``(6 & 2) || (6 & 16)``.
``` | f67ad6c8a473eeddc16c7e1750aab535dfe294dd | 01e0b7ce4281529078adf5e20a78a48b8ae55831 | diff --git a/doc/templates.rst b/doc/templates.rst
index 0486c52e3c7..c80285e90fc 100644
--- a/doc/templates.rst
+++ b/doc/templates.rst
@@ -514,13 +514,40 @@ Twig allows expressions everywhere.
.. note::
+ Twig uses operators to perform various operations within templates. Understanding
+ the precedence of ... | [
"doc/templates.rst"
] | [
{
"comment": "This part should not be marked as twig code block.\r\nRather, inline code is more appropriate: \r\n\r\n```\r\nThis means that ``{{ 6 b-and 2 or 6 b-and 16 }}`` results in ``(6 & 2) || (6 & 16)``.\r\n```",
"path": "doc/templates.rst",
"hunk": "@@ -514,13 +514,41 @@ Twig allows expressions e... | true | ||
twigphp/Twig | 3,941 | issue_to_patch | add docs & links | 804cb1b85b92d995cea958401adedb0f5ed37558 | dd24d5bfd262e27588b81ed47d4ff2fd3ac692a4 | diff --git a/doc/filters/batch.rst b/doc/filters/batch.rst
index 18a227feb39..adb2948c6a3 100644
--- a/doc/filters/batch.rst
+++ b/doc/filters/batch.rst
@@ -12,8 +12,8 @@ missing items:
<table>
{% for row in items|batch(3, 'No item') %}
<tr>
- {% for column in row %}
- ... | [
"doc/filters/batch.rst",
"doc/filters/date.rst",
"doc/filters/keys.rst",
"doc/filters/lower.rst",
"doc/filters/reduce.rst",
"doc/filters/slice.rst",
"doc/filters/upper.rst"
] | [
{
"comment": "```suggestion\r\n* ``format``: The date format. Default format is 'F j, Y H:i', which will render 'January 11, 2024 15:17'\r\n```",
"path": "doc/filters/date.rst",
"hunk": "@@ -68,11 +68,12 @@ The default timezone can also be set globally by calling ``setTimezone()``::\n Arguments\n ----... | true | |||
twigphp/Twig | 3,941 | comment_to_fix | add docs & links | ```suggestion
* ``format``: The date format. Default format is 'F j, Y H:i', which will render 'January 11, 2024 15:17'
``` | 804cb1b85b92d995cea958401adedb0f5ed37558 | dd24d5bfd262e27588b81ed47d4ff2fd3ac692a4 | diff --git a/doc/filters/date.rst b/doc/filters/date.rst
index 70470f0f4d2..7ac9b8750a3 100644
--- a/doc/filters/date.rst
+++ b/doc/filters/date.rst
@@ -47,7 +47,7 @@ Timezone
By default, the date is displayed by applying the default timezone (the one
specified in php.ini or declared in Twig -- see below), but you ... | [
"doc/filters/date.rst"
] | [
{
"comment": "```suggestion\r\n* ``format``: The date format. Default format is 'F j, Y H:i', which will render 'January 11, 2024 15:17'\r\n```",
"path": "doc/filters/date.rst",
"hunk": "@@ -68,11 +68,12 @@ The default timezone can also be set globally by calling ``setTimezone()``::\n Arguments\n ----... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.