Skip to content

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

Open
jorgsowa wants to merge 2 commits into
php:masterfrom
jorgsowa:jorgsowa/hash-find-ptr-lc-batch2
Open

Use zend_hash_find_ptr_lc() for case-insensitive name lookups#22591
jorgsowa wants to merge 2 commits into
php:masterfrom
jorgsowa:jorgsowa/hash-find-ptr-lc-batch2

Conversation

@jorgsowa

@jorgsowa jorgsowa commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Continues #22565 for four sites that were missed: _class_exists_impl(), function_exists(), pdo_stmt.c's dbstmt_method_get(), ReflectionClass:: hasMethod()/getMethod(), and phpdbg's print func/method commands. No behavior change.

Continues php#22565 for four sites that were missed: _class_exists_impl(),
function_exists(), pdo_stmt.c's dbstmt_method_get(), ReflectionClass::
hasMethod()/getMethod(), and phpdbg's print func/method commands. No
behavior change.

@Girgias Girgias left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except the reflection changes, makes sense.


GET_REFLECTION_OBJECT_PTR(ce);
lc_name = zend_string_tolower(name);
RETVAL_BOOL(zend_hash_exists(&ce->function_table, lc_name) || is_closure_invoke(ce, lc_name));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The is_closure_invoke is way more legible. Just fix that function by using zend_string_equals_ci() in it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, makes sense. Done

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