Skip to content

Use zend_hash_find_ptr_lc() for case-insensitive name lookups#22565

Merged
Girgias merged 1 commit into
php:masterfrom
jorgsowa:refactor/hash-find-ptr-lc
Jul 2, 2026
Merged

Use zend_hash_find_ptr_lc() for case-insensitive name lookups#22565
Girgias merged 1 commit into
php:masterfrom
jorgsowa:refactor/hash-find-ptr-lc

Conversation

@jorgsowa

@jorgsowa jorgsowa commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

A number of call sites lowercased a class/function/method name into a temporary string solely to use it as a lookup key in the class table, function table, module registry, etc., then released it. Replace those with zend_hash_find_ptr_lc() / zend_hash_str_find_ptr_lc(), which lowercase into a stack buffer (for short names), perform the lookup, and free the temporary internally.

This removes the manual tolower + release boilerplate at 17 sites. No behavior change.

Extracted from #22260

A number of call sites lowercased a class/function/method name into a
temporary string solely to use it as a lookup key in the class table,
function table, module registry, etc., then released it. Replace those
with zend_hash_find_ptr_lc() / zend_hash_str_find_ptr_lc(), which
lowercase into a stack buffer (for short names), perform the lookup, and
free the temporary internally.

This removes the manual tolower + release boilerplate at 17 sites and
avoids a heap allocation for the common short-name case. No behavior
change.
@Girgias Girgias merged commit 39b66ba into php:master Jul 2, 2026
18 checks passed
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.

2 participants