Skip to content

Remove most uses of mysqli_free_result. - #1703

Open
bpfoley wants to merge 1 commit into
DistributedProofreaders:masterfrom
bpfoley:rm-free
Open

bpfoley wants to merge 1 commit into
DistributedProofreaders:masterfrom
bpfoley:rm-free

Conversation

@bpfoley

@bpfoley bpfoley commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

mysqli_result objects, like all PHP values, are reference counted. When they are overwritten (eg when assigned to in a loop), or when they go out of scope (eg at the end of a block/function), the refcount is decremented, and the object freed when the refcount reaches zero.

Thus we can remove mysqli_free_result when it occurs close to the end of a block/function, because it only shortens the lifetime of a result by a tiny amount and clutters up the code for negligible benefit.

mysqli_result objects, like all PHP values, are reference counted.
When they are overwritten (eg when assigned to in a loop), or
when they go out of scope (eg at the end of a block/function),
the refcount is decremented, and the object freed when the refcount
reaches zero.

Thus we can remove mysqli_free_result when it occurs close to the
end of a block/function, because it only shortens the lifetime of
a result by a tiny amount and clutters up the code for negligible
benefit.
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