You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Kandelo SQLite package (examples/libs/sqlite/build-sqlite.sh) builds libsqlite3 without -DSQLITE_ENABLE_COLUMN_METADATA, so the linker omits sqlite3_column_table_name(), sqlite3_column_database_name(), and sqlite3_column_origin_name() from the static library. PHP's pdo_sqlite extension unconditionally calls sqlite3_column_table_name() from pdo_sqlite_stmt_col_meta() (the C-side of PDOStatement::getColumnMeta()), so the symbol is left undefined in the linked PHP binary, the wasm linker emits it as an env. import, and the kernel worker stubs it with a throwing function:
Error: Unimplemented import: env.sqlite3_column_table_name
at php-fpm.pdo_sqlite_stmt_col_meta (wasm-function[18575])
at php-fpm.zim_PDOStatement_getColumnMeta (wasm-function[18465])
Any call to \$stmt->getColumnMeta(N) kills the kernel-mode worker on the first row read.
Why this matters
The headline integration target on the roadmap (#382, Layer 0) is WordPress Playground with --experimental-posix-kernel. WordPress's modern SQLite driver (the WP_SQLite_Driver / WP_SQLite_Connection classes shipped from sqlite-database-integration v3.x / trunk) is the canonical entry point for Adminer and phpMyAdmin in Playground:
Both shims target the modern driver, which calls PDOStatement::getColumnMeta() for every column on every query. Without SQLITE_ENABLE_COLUMN_METADATA, the kernel-mode worker dies on the first query. The classic Emscripten-based php-wasm build statically links a libsqlite3 with column metadata enabled — see packages/php-wasm/compile/libsqlite3/Dockerfile (CFLAGS=\"-DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_USE_URI\") in WordPress/wordpress-playground — so reaching feature parity with the kernel-mode build is what unblocks the modern SQLite driver path.
This is a sibling gap to #550 (libzip + --with-zip) and #551 (libcurl + --with-curl). All three are configure / build-flag adjustments to the kernel-mode PHP toolchain.
Reproducer
Against any current Kandelo PHP CLI binary:
echo '<?php
\$pdo = new PDO(\"sqlite::memory:\");
\$pdo->exec(\"CREATE TABLE t (c INTEGER)\");
\$pdo->exec(\"INSERT INTO t VALUES (1)\");
\$stmt = \$pdo->query(\"SELECT c FROM t\");
var_dump(\$stmt->getColumnMeta(0));
' | <run-php-via-kernel> -r -
# Expected: array(...) { [\"native_type\"] => \"integer\" [\"table\"] => \"t\" ... }
# Actual: Error: Unimplemented import: env.sqlite3_column_table_name
SQLITE_ENABLE_COLUMN_METADATA is gating. Without it, libsqlite3 omits sqlite3_column_table_name, sqlite3_column_database_name, and sqlite3_column_origin_name from the build. PHP's ext/pdo_sqlite/sqlite_statement.c:pdo_sqlite_stmt_col_meta() references sqlite3_column_table_name() unconditionally, so the symbol is undefined in the PHP binary, emitted as an env. import by the wasm linker, and stubbed by wasm-posix-kernel/host/src/worker-main.ts:660 with a throwing function.
Proposed fix
Three small pieces (mirrors #550 / #551, but smaller — no new package, no new `--with-*` flag):
Add the define in examples/libs/sqlite/build-sqlite.sh: append -DSQLITE_ENABLE_COLUMN_METADATA to SQLITE_CFLAGS.
Bump examples/libs/sqlite/build.toml revision from 1 to 2 so the content-addressed cache rebuilds rather than serving the pre-define archive.
Bump examples/libs/php/build.toml revision from 2 to 3 so PHP relinks against the new libsqlite3.a (PHP statically links it).
No ABI_VERSION bump required (libsqlite3 capability change, not a kernel ABI change).
Acceptance
A PHP CLI script calling \$stmt->getColumnMeta(0) against an in-memory PDO returns the full metadata array including table, not an "Unimplemented import" error.
The published binaries-abi-v<N> index entries for sqlite and php on wasm32 reference the new revisions.
WordPress Playground's Adminer kernel-mode test passes (website-ui.spec.ts:437 Adminer — currently test.skip()'d citing this issue) under packages/playground/website/playwright/e2e/posix-kernel/. (:509 phpMyAdmin will surface once PHP: add libzip + --with-zip so ZipArchive works #550 lands, since its install pipeline calls unzipFile first.)
Summary
The Kandelo SQLite package (
examples/libs/sqlite/build-sqlite.sh) builds libsqlite3 without-DSQLITE_ENABLE_COLUMN_METADATA, so the linker omitssqlite3_column_table_name(),sqlite3_column_database_name(), andsqlite3_column_origin_name()from the static library. PHP'spdo_sqliteextension unconditionally callssqlite3_column_table_name()frompdo_sqlite_stmt_col_meta()(the C-side ofPDOStatement::getColumnMeta()), so the symbol is left undefined in the linked PHP binary, the wasm linker emits it as anenv.import, and the kernel worker stubs it with a throwing function:Any call to
\$stmt->getColumnMeta(N)kills the kernel-mode worker on the first row read.Why this matters
The headline integration target on the roadmap (#382, Layer 0) is WordPress Playground with
--experimental-posix-kernel. WordPress's modern SQLite driver (theWP_SQLite_Driver/WP_SQLite_Connectionclasses shipped fromsqlite-database-integrationv3.x / trunk) is the canonical entry point for Adminer and phpMyAdmin in Playground:adminer-mysql-on-sqlite-driver.php:19—require_once \$wp_env['db']['driver_path']DbiMysqli.php:28(phpMyAdmin) — same patternBoth shims target the modern driver, which calls
PDOStatement::getColumnMeta()for every column on every query. WithoutSQLITE_ENABLE_COLUMN_METADATA, the kernel-mode worker dies on the first query. The classic Emscripten-based php-wasm build statically links a libsqlite3 with column metadata enabled — seepackages/php-wasm/compile/libsqlite3/Dockerfile(CFLAGS=\"-DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS5 -DSQLITE_USE_URI\") inWordPress/wordpress-playground— so reaching feature parity with the kernel-mode build is what unblocks the modern SQLite driver path.This is a sibling gap to #550 (libzip +
--with-zip) and #551 (libcurl +--with-curl). All three are configure / build-flag adjustments to the kernel-mode PHP toolchain.Reproducer
Against any current Kandelo PHP CLI binary:
Root cause
examples/libs/sqlite/build-sqlite.sh:57-64definesSQLITE_CFLAGSwith:SQLITE_ENABLE_COLUMN_METADATAis gating. Without it, libsqlite3 omitssqlite3_column_table_name,sqlite3_column_database_name, andsqlite3_column_origin_namefrom the build. PHP'sext/pdo_sqlite/sqlite_statement.c:pdo_sqlite_stmt_col_meta()referencessqlite3_column_table_name()unconditionally, so the symbol is undefined in the PHP binary, emitted as anenv.import by the wasm linker, and stubbed bywasm-posix-kernel/host/src/worker-main.ts:660with a throwing function.Proposed fix
Three small pieces (mirrors #550 / #551, but smaller — no new package, no new `--with-*` flag):
examples/libs/sqlite/build-sqlite.sh: append-DSQLITE_ENABLE_COLUMN_METADATAtoSQLITE_CFLAGS.examples/libs/sqlite/build.tomlrevision from1to2so the content-addressed cache rebuilds rather than serving the pre-define archive.examples/libs/php/build.tomlrevision from2to3so PHP relinks against the newlibsqlite3.a(PHP statically links it).No
ABI_VERSIONbump required (libsqlite3 capability change, not a kernel ABI change).Acceptance
\$stmt->getColumnMeta(0)against an in-memory PDO returns the full metadata array includingtable, not an "Unimplemented import" error.binaries-abi-v<N>index entries forsqliteandphponwasm32reference the new revisions.website-ui.spec.ts:437Adminer — currentlytest.skip()'d citing this issue) underpackages/playground/website/playwright/e2e/posix-kernel/. (:509phpMyAdmin will surface once PHP: add libzip + --with-zip so ZipArchive works #550 lands, since its install pipeline callsunzipFilefirst.)References
test.skip()'d citing this issue):website-ui.spec.ts:437(Adminer)packages/php-wasm/compile/libsqlite3/Dockerfileexamples/libs/sqlite/build-sqlite.sh:57-64wp-content/plugins/sqlite-database-integration/wp-includes/database/load.php(fromsqlite-database-integrationtrunk)--with-zip), PHP: add libcurl wiring + --with-curl so curl_init() works #551 (libcurl +--with-curl)