# OnXXXXX handlers not called in ZTS environment

- Thread: https://externals.io/message/2099
- Original archive: https://news-web.php.net/php.internals/2099
- Started by Uwe Schindler on 2003-05-30T23:18:17+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #2099 — Uwe Schindler — 2003-05-30T23:18:17+00:00

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

When changing a ini entry with zend_alter_ini_entry during runtime the 
Callback routines OnUpdateXXXX are never called. This problem only exists 
in multithreaded environments.
I think that the handler field in the entry is not copied when creating the 
copy of the ini entries after creating a new thread ressource:

#ifdef ZTS
ZEND_API int zend_copy_ini_directives(TSRMLS_D)
{
         zend_ini_entry ini_entry;

         EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable));
         if (zend_hash_init_ex(EG(ini_directives), 
registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) {
                 return FAILURE;
         }
         zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, 
NULL, &ini_entry, sizeof(zend_ini_entry));
         zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
         return SUCCESS;
}
#endif

I am not very familar with the Zend engine so I do not know how to 
implement this, but the following command does not ever call the OnUpdate 
handler:
zend_alter_ini_entry(....., PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME)

Uwe

---

## #2106 — marcus.boerger@t-online.de — 2003-05-31T10:32:55+00:00

URL: https://externals.io/message/2099#2106 · In reply to: #2099

At 01:18 31.05.2003, Uwe Schindler wrote:
>When changing a ini entry with zend_alter_ini_entry during runtime the 
>Callback routines OnUpdateXXXX are never called. This problem only exists 
>in multithreaded environments.
>I think that the handler field in the entry is not copied when creating 
>the copy of the ini entries after creating a new thread ressource:

The zend_hash_copy() function copies the all the information so the problem 
should be elsewhere.
[...]
>I am not very familar with the Zend engine so I do not know how to 
>implement this, but the following command does not ever call the OnUpdate 
>handler:
>zend_alter_ini_entry(....., PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME)


And here we go: PHP_INI_SYSTEM values cannot be set at runtime, that's 
their sense.

regards
marcus

---

## #2107 — Uwe Schindler — 2003-05-31T10:40:48+00:00

URL: https://externals.io/message/2099#2107 · In reply to: #2099

Its the same in the other way without PHP_INI_SYSTEM. They get changed. 
Only the handler is not called.

At 12:32 31.05.2003 +0200, you wrote:
>At 01:18 31.05.2003, Uwe Schindler wrote:
> > […]
>
>The zend_hash_copy() function copies the all the information so the 
>problem should be elsewhere.
>[...]
> > […]
>
>
>And here we go: PHP_INI_SYSTEM values cannot be set at runtime, that's 
>their sense.
>
>regards
>marcus

-----
Uwe Schindler
Addr 1: Bamberger Str. 24a, D-96049 Bamberg
Addr 2: Drausnickstr. 153, D-91052 Erlangen
http://www.thetaphi.de - http:///www.schindlers-software.de
eMails: uwe@thetaphi.de (private); info@schindlers-software.de (company)
Tel./Fax: +49 700 PCLATEIN (+49 700 72528346)

Schindlers Software - Home of Schindlers PC-LATEIN 3.10
DIE Software zum Lateinlernen!
