Questions on history of zend_module_entry
| From: | Levi Morrison | Date: | Fri, 29 Apr 2022 16:23:52 +0000 |
| Subject: | Questions on history of zend_module_entry | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-117649@lists.php.net to get a copy of this message | ||
Hello, for two separate reasons I was recently reviewing
zend_module_entry's layout and usage and there are two things I don't
understand:
1. Why does zend_module_entry have a
.size member, if it's not
actually used anywhere as far as I can tell from both reading code and
setting debugger watchpoints? One place it probably _ought_ to be used
is when we copy the module entry in zend_register_module_ex
(https://heap.space/xref/php-src/Zend/zend_API.c?r=733023b2#2381), but
sizeof(zend_module_entry) is used instead.
2. Why do we copy the module entry in zend_register_module_ex
anyway? I've dug through git history a bit but haven't found anything
notable so far. It seems like we should store the parameter and
document it needing to have a static lifetime (or a heap-allocated
lifetime which just leaks), which would satisfy both get_module() and
the hybrid extension/zend_extension hacks.
In any case, the particular combination of these two points makes it
seem like something is broken, wrong, or obsolete and needs to be
documented as such. I am hoping someone here knows the history or
background on this!