Skip to content

Drop unused class_cleanup_handlers - #23696

Merged
ndossche merged 1 commit into
php:masterfrom
ndossche:remove-ce-cleanup-handlers
Sep 15, 2026
Merged

ndossche merged 1 commit into
php:masterfrom
ndossche:remove-ce-cleanup-handlers

Conversation

@ndossche

Copy link
Copy Markdown
Member

This is only ever written to, but never read, and since this is static, no other translation unit or module can access this too.

This is only ever written to, but never read, and since this is static,
no other translation unit or module can access this too.
Comment thread Zend/zend_API.c
Comment on lines -2613 to -2619
/* Collect internal classes with static members */
ZEND_HASH_MAP_FOREACH_PTR(CG(class_table), ce) {
if (ce->type == ZEND_INTERNAL_CLASS &&
ce->default_static_members_count > 0) {
class_count++;
}
} ZEND_HASH_FOREACH_END();

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.

Why is this included?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because the class_count variable was only used for class_cleanup_handlers

@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.

I'm confused by what that code is actually doing, it seems to handle something that needs to be possibly handled (static properties(?)) but in the most bizarre way

@ndossche

Copy link
Copy Markdown
Member Author

I'm confused by what that code is actually doing, it seems to handle something that needs to be possibly handled (static properties(?)) but in the most bizarre way

Once upon a time, some static memory needed explicit freeing. It no longer does now, that code was removed, but the code that builds the class_cleanup_handlers array was not.

@ndossche
ndossche merged commit 38956a3 into php:master Sep 15, 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