Skip to content

[5.x] Return the bound parameters by value from getBounded() - #412

Open
Hackwar wants to merge 2 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-getbounded-no-reference
Open

Hackwar wants to merge 2 commits into
joomla-framework:5.x-devfrom
Hackwar:5.x-getbounded-no-reference

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary of Changes

QueryInterface::&getBounded() and DatabaseQuery::&getBounded() returned the bound parameters by reference. The bindings reference $obj->value of each bound-parameter object, so the reference has no effect; it only forces implementers to declare &. The & is removed from the interface and from DatabaseQuery, and the driver execute() methods assign the result normally (the same change as #404 on 4.x; the identical lines merge cleanly when 4.x-dev is merged up).

Existing implementations that still declare &getBounded() remain compatible with the interface (a by-reference return is accepted where a by-value return is declared); callers that use =& on the result get a notice, hence the update-guide entry.

Alternative to #352 (kamil-tekiela), split into the 4.x and 5.x parts.

Testing Instructions

Existing binding tests (e.g. testRepeatedSelectStatement, rebinding a variable between executions) pass; vendor/bin/phpunit -c phpunit.sqlite.xml.dist.

Documentation Changes Required

Entry "getBounded() no longer returns by reference" in docs/v4-to-v5-update.md.

Depends on #404 and #410 (this branch is based on it).

🤖 Generated with Claude Code

Hackwar and others added 2 commits November 12, 2026 23:48
Several 5.0 changes need an entry in the update guide; adding the empty
guide first keeps their pull requests from conflicting over its creation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
QueryInterface::getBounded() and DatabaseQuery::getBounded() returned by
reference for no reason: the bindings reference the value property of the
bound parameter objects, not the array slots. Implementations no longer
need to declare the reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant