Skip to content

Stdlib: SQLite3Stmt bindParam/getSQL/readOnly + Result columnType after step (ext/sqlite3/php_sqlite3.c) #19854

Description

@PurHur

Category

stdlib · php-src-strict · ext/sqlite3 multi-row API (follow-up to #19821)

Problem

#19821 shipped query/prepare, SQLite3Result::{fetchArray,numColumns,finalize}, SQLite3Stmt::{bindValue,execute,reset}, plus changes/lastInsertRowID/escapeString. Remaining Zend surface still missing or incomplete:

API Gap
SQLite3Stmt::bindParam missing (by-ref)
SQLite3Stmt::getSQL / readOnly missing
SQLite3Result::columnType before first fetchArray may not match Zend (needs stepped row)
Named bind placeholders (:name) bindValue is 1-based int only

php-src reference

PHP implementation target

  • ext/sqlite3/VmSQLite3Stmt.php / VmSQLite3Result.php / VmSqlite3Native.php — PHP-in-PHP + thin FFI

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
export PHP_COMPILER_PROFILE=8.4
cat > /tmp/sqlite3_stmt_rest.php <<'"'"'PHP'"'"'
<?php
$db = new SQLite3(":memory:");
$db->exec("CREATE TABLE t(v TEXT)");
$st = $db->prepare("INSERT INTO t VALUES (:v)");
echo "bindParam=", method_exists($st, "bindParam") ? "1" : "0", "\n";
echo "getSQL=", method_exists($st, "getSQL") ? "1" : "0", "\n";
echo "readOnly=", method_exists($st, "readOnly") ? "1" : "0", "\n";
PHP
php bin/vm.php /tmp/sqlite3_stmt_rest.php
'

Expected (Zend): all 1. VM after #19821: all 0.

Done when

  • bindParam + named :v bindValue work for a simple INSERT
  • getSQL() / readOnly() match Zend for a prepared INSERT vs SELECT
  • Compliance .phpt under test/compliance/cases/ext/
  • php-src-strict on PHP_COMPILER_PROFILE=8.4

Related

#19821 (merged) · #19838 · #3434

Activity

  1. added
    bugSomething isn't working
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 17, 2026
  2. PurHur commented on Jul 17, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler Ext — I/O & Crypto — starting this run

    Gate snapshot (before claim):

    • bootstrap-selfhost-link: green
    • bootstrap-inventory --check: OK 5288/5288
    • release-readiness --json: user_release_ready: no
      • first fail: check-selfhost-spine-coverage-sync — missing ext/sqlite3/VmSQLite3Stmt.php
      • north-star5-verify-fast: fail (same spine sync)
    • bootstrap-selfhost-vm-driver-execute-probe: ok

    Implementing bindParam / getSQL / readOnly + named binds; will restore spine coverage for VmSQLite3Stmt.php as part of this.

  3. PurHur commented on Jul 17, 2026

    @PurHur
    OwnerAuthor

    Merged in #19858

    Verification:

    • Issue repro green on VM (bindParam/getSQL/readOnly, named binds, live bindParam re-read, columnType false before fetch)
    • Spine coverage restored (5288/5288) — was Pillar 1 red for missing VmSQLite3Stmt.php et al.
    • PHPUnit sqlite3 filter 6/6; north-star5-verify-fast OK
  4. PurHur commented on Jul 17, 2026

    @PurHur
    OwnerAuthor

    Merged: #19858 (squash)

    Done-when covered:

    • bindParam + named :v / :name bindValue
    • getSQL() / readOnly() for INSERT vs SELECT
    • columnType returns false before first fetchArray (sqlite3_data_count)
    • Compliance test/compliance/cases/ext/sqlite3_stmt_bindparam_getsql.phpt
    • Spine coverage restored (Pillar 1 was red on missing sqlite3 stmt/result units)
    • north-star5-verify-fast OK before merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions