Skip to content

Fix GH-22051: report errors from SQLite3Result reset and finalize#22363

Open
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/gh-22051-sqlite3-result-reset
Open

Fix GH-22051: report errors from SQLite3Result reset and finalize#22363
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/gh-22051-sqlite3-result-reset

Conversation

@iliaal

@iliaal iliaal commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

SQLite3Stmt::reset() reports a failed sqlite3_reset() through php_sqlite3_error(), but SQLite3Result::reset() returned false silently and SQLite3Result::finalize() ignored the result. Both now report the same way; finalize() keeps its : true return type and reports without changing it. The other sqlite3_reset/sqlite3_finalize calls are left unchecked deliberately: resets after a successful step cannot fail, the reset-before-execute for bug #77051 returns the prior run's stale code, the error-path finalize calls would re-report an error already surfaced in the same function, and the destructor calls have no userland frame to report from.

Fixes #22051

SQLite3Stmt::reset() reports a failed sqlite3_reset() through
php_sqlite3_error(), but SQLite3Result::reset() returned false silently
and SQLite3Result::finalize() ignored the result. Both now surface the
underlying SQLite error the same way; finalize() keeps its : true return
type and reports without altering the return value.

Fixes phpGH-22051

@LamentXU123 LamentXU123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong opinions. Might need to hear from @ndossche to deal with this as I have zero experience in sqlite.

@ndossche ndossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to me. Could ask Saki for a double check as dbs are her cup of tea.

@ndossche ndossche requested a review from SakiTakamachi June 19, 2026 07:47

@LamentXU123 LamentXU123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I could tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent/missing checks for sqlite3 APIs

3 participants