[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6

From: Date: Mon, 02 Nov 2026 19:43:10 +0000
Subject: [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143236@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-03T03:27:09+08:00 Commit: https://github.com/php/php-src/commit/4bedd96375f0599ef4169ee65de6b39a4f2a18d8 Raw diff: https://github.com/php/php-src/commit/4bedd96375f0599ef4169ee65de6b39a4f2a18d8.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: Fix GH-24990: pdo_sqlite statement unusable after failed execute() (#24991) Changed paths: A ext/pdo_sqlite/tests/gh24990.phpt M NEWS M ext/pdo_sqlite/sqlite_statement.c Diff: diff --git a/NEWS b/NEWS index 9fb2c3cb0153..e78542913b0f 100644 --- a/NEWS +++ b/NEWS @@ -170,6 +170,9 @@ PHP NEWS . Fixed bug GH-24461 (DISCARD ALL on persistent connection cleanup drops PgBouncer's prepared statements). (David Carlier, Artem Ukrainskiy) +- PDO_SQLite: + . Fixed bug GH-24990 (Statement unusable after a failed execute()). (lazerg) + - Phar: . Fixed bug GH-25093 (Phar::webPhar() redirect reads past the request URI). (lazerg) diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index 58e50bf3fe53..0d088c99ce7a 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -65,11 +65,10 @@ static int pdo_sqlite_stmt_execute(pdo_stmt_t *stmt) return 1; case SQLITE_ERROR: - sqlite3_reset(S->stmt); - ZEND_FALLTHROUGH; case SQLITE_MISUSE: case SQLITE_BUSY: default: + sqlite3_reset(S->stmt); pdo_sqlite_error_stmt(stmt); return 0; } diff --git a/ext/pdo_sqlite/tests/gh24990.phpt b/ext/pdo_sqlite/tests/gh24990.phpt new file mode 100644 index 000000000000..89bfe35e74bc --- /dev/null +++ b/ext/pdo_sqlite/tests/gh24990.phpt @@ -0,0 +1,33 @@ +--TEST-- +GH-24990 (Statement unusable after a failed execute()) +--EXTENSIONS-- +pdo_sqlite +--FILE-- +<?php +$db = new PDO('sqlite::memory:', options: [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]); +$db->exec('CREATE TABLE test (k TEXT PRIMARY KEY NOT NULL)'); +$db->exec("INSERT INTO test VALUES ('a')"); + +$stmt = $db->prepare('INSERT INTO test (k) VALUES (?)'); +foreach (['a', 'b', 'b', 'c'] as $k) { + try { + var_dump($stmt->execute([$k])); + } catch (PDOException $e) { + echo $e->getMessage(), "\n"; + } +} +var_dump($db->query('SELECT k FROM test ORDER BY k')->fetchAll(PDO::FETCH_COLUMN)); +?> +--EXPECT-- +SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: test.k +bool(true) +SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: test.k +bool(true) +array(3) { + [0]=> + string(1) "a" + [1]=> + string(1) "b" + [2]=> + string(1) "c" +}

« previous php.cvs (#143236) next »