# tsrm_shutdown() and the CLI SAPI

- Thread: https://externals.io/message/23843
- Original archive: https://news-web.php.net/php.internals/23843
- Started by Frank M. Kromann on 2006-06-01T05:19:13+00:00
- Messages: 2
- 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

---

## #23843 — Frank M. Kromann — 2006-06-01T05:19:13+00:00

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

> > […]
think 
> > […]
> 
> ts_free_id() would be a correct workaround if it came from
zend_shutdown(). 
> How's it right to suddenly force EVERY extension author to add it to
their 
> code individually?

This was only reqiured in extensions registering custom dtor's like tidy
and printer.

- Frank

---

## #23858 — Steph Fox — 2006-06-01T17:36:14+00:00

URL: https://externals.io/message/23843#23858 · In reply to: #23843

> > […]
> zend_shutdown().
> > […]
> their
> > […]
>
> This was only reqiured in extensions registering custom dtor's like tidy
> and printer.
>
Unfortunately that's not true. It's also required in the php-gtk module even 
though we don't declare a dtor - the DL_UNLOAD call is the first thing in 
the shutdown process, and if you _don't_ have free_ts_id() in MSHUTDOWN at 
present you'll be freeing the resource after the module's unloaded. 
DL_UNLOAD is called on anything loaded via `dl()` or the php.ini....

This isn't our only problem though - the GLOBAL_CLASS_TABLE is being 
destroyed during CG dtor because it doesn't match the current 
CG->global_class_table. Because the CG dtor is run after the PHP-GTK module 
is unloaded, destroying that class table crashes the shutdown process.

I've no idea why or how GTK classes end up in the CG global class table, but 
I guess that's what happening here. Any offers?

- Steph
