Skip to content

Cast scalar values to string before quoting them - #222

Merged
simon-mundy merged 5 commits into
php-db:0.6.xfrom
simon-mundy:fix/205-quote-value-scalars
Oct 9, 2026
Merged

simon-mundy merged 5 commits into
php-db:0.6.xfrom
simon-mundy:fix/205-quote-value-scalars

Conversation

@simon-mundy

Copy link
Copy Markdown
Member

Fixes #205.

Integer and boolean values reached PlatformInterface::quoteValue(string) from strict-typed call sites, raising a TypeError on any platform that keeps the string type.

Changes

  • Select::processLimit() and processOffset() cast the limit and offset to string before quoting.
  • AbstractSql::resolveColumnValue() casts the column value to string before quoting, as the expression path already does.
  • TrustingSql92Platform::quoteValue() keeps the string parameter type, so the suite fails if a call site passes a non-string again. With only this change, 6 existing tests error.

Breaking changes

None. Prepared statements are unaffected; they bind values rather than quoting them.

mago format, mago lint, mago analyze and the unit tests pass.

PlatformInterface::quoteValue() takes a string, so an integer limit,
offset or column value raised a TypeError under strict types once a
platform with a driver tried to quote it. The test platform now keeps
the string type, so the suite catches the same mistake again.

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
@simon-mundy simon-mundy added documentation Improvements or additions to documentation qa Improvements in quality assurance of the project Lang Feature Refactor Refactoring to new language features labels Oct 5, 2026
@github-project-automation github-project-automation Bot moved this to Todo in @phpdb Oct 5, 2026
@simon-mundy simon-mundy added this to the 0.6.0 milestone Oct 5, 2026
@simon-mundy simon-mundy self-assigned this Oct 5, 2026
@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…lue-scalars

# Conflicts:
#	analyzer-baseline.toml
@simon-mundy
simon-mundy requested a review from tyrsson October 6, 2026 02:21
tyrsson
tyrsson previously approved these changes Oct 8, 2026
@simon-mundy
simon-mundy merged commit cd8b726 into php-db:0.6.x Oct 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation Lang Feature Refactor Refactoring to new language features qa Improvements in quality assurance of the project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Integer limit, offset and column values raise TypeError in getSqlString() on a strict platform

2 participants