# issue in copying the hash table

- Thread: https://externals.io/message/10721
- Original archive: https://news-web.php.net/php.internals/10721
- Started by Kamesh Jayachandran on 2004-06-23T10:41:14+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #10721 — Kamesh Jayachandran — 2004-06-23T10:41:14+00:00

URL: https://externals.io/message/10721#10721

Hi All,
I could not understand one piece of code in PHP 5.0 RC3.
File Zend/zend.c
function compiler_globals_ctor()

Here we copy global_class_table to thread specific compiler_globals's
class_table.
For this we use zend_hash_copy which is a generic function used by many
types.
As of my knowledge our class table HashTable structure is structured as,
key = char*
value = zend_class_entry **
If it is the case how this zend_hash_copy will work?
As I could see zend_hash_copy calls zend_hash_add_or_update with data as
the bucket's pData which is void* and semantically zend_class_entry **
and memcpy of INIT_DATA macro tries to copy from whatever pData points
to (zend_class_entry**) till sizeof(zend_class_entry)=292 bytes which is
wrong shoudl cause seg fault ideally.

Please clarify.

With regards
Kamesh Jayachandran
