Skip to content

Default untyped bind parameters to string and tidy Statement::__clone() - #84

Merged
tyrsson merged 1 commit into
0.5.xfrom
tyrsson-fix-untyped-bind-parameters
Oct 7, 2026
Merged

tyrsson merged 1 commit into
0.5.xfrom
tyrsson-fix-untyped-bind-parameters

Conversation

@tyrsson

@tyrsson tyrsson commented Oct 7, 2026

Copy link
Copy Markdown
Member

Cherry-picks 588e5d6 onto 0.5.x.

Why

PR #78 ("Fix argument count error") was based on mago-format-reformat, not 0.5.x. That branch had already been merged into 0.5.x via #57 on 2026-08-31 — five weeks before #78 landed on it on 2026-10-07. So #78's merge commit (2f6aeb5) is not an ancestor of 0.5.x and the fix never reached the default branch, while issue #83 was closed and placed on milestone 0.5.0.

Net effect: #83 was recorded as fixed in 0.5.0 but the bug was still live on 0.5.x. A check of all 33 merged PRs confirms #78 is the only one whose commits are not on 0.5.x (#58 and #60 landed correctly via #57).

What

bindParametersFromContainer() only appended a type character for parameters carrying errata, so untyped parameters produced an empty or short types string and bind_param() failed. Untyped parameters now bind as s.

__clone() is restored to the mysqli Statement — 0.5.x currently has no __clone() at all, so a cloned statement shared its ParameterContainer. It now deep-clones the container, resets isPrepared, and gains a void return type.

Testing

  • phpunit --testsuite "unit test" — 193 tests, 385 assertions, OK.
  • Both new unit tests were run against origin/0.5.x's Statement.php and fail there, so they genuinely cover the fix.
  • mago format --check, mago lint and mago analyze are all clean (121 baselined issues filtered, no new findings).
  • test/integration/Mysqli/StatementResultTest.php needs a live MySQL, so it is left to CI.

Cherry-picked from 588e5d6e06cc1874d806fb008520cd0b034b0455; the resulting tree is byte-identical to that commit. The only conflict was the absent __clone().

Closes #83

bindParametersFromContainer() only added a type character for parameters
with errata, so untyped parameters produced an empty or short types string
and bind_param() failed. Untyped parameters now bind as 's' again.

__clone() gains a void return type and the TODO is dropped: the mysqli
Statement never had a __clone() in this repository, only the PDO Statement
did before it moved to phpdb core.

Fixes #83

(cherry picked from commit 588e5d6)
@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tyrsson
tyrsson merged commit 7a40af2 into 0.5.x Oct 7, 2026
15 checks passed
@tyrsson
tyrsson deleted the tyrsson-fix-untyped-bind-parameters branch October 7, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Statement::bindParametersFromContainer() sends an empty types string for untyped parameters

2 participants