[php-src] PR #24299: Zend: add zend_alter_ini_entry_str_ex() and literal macros
| From: | jorgsowa | Date: | Tue, 13 Oct 2026 16:07:28 +0000 |
| Subject: | [php-src] PR #24299: Zend: add zend_alter_ini_entry_str_ex() and literal macros | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39383@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24299
Author: jorgsowa
Changing an
INI setting with a known name required allocating a temporary
zend_string for the name, which was then hashed and compared by content instead of by
pointer, and released again. Mirror the read-side zend_ini_*_literal() API and look the
entry up by const char * instead.
Convert the existing call sites. Approximate savings per request (if request set up dynamically
those INI directives):
```
┌─────────────────────────────────────────┬────────────────────────────────────┐
│ Call │ Saved │
├─────────────────────────────────────────┼────────────────────────────────────┤
│ set_time_limit() │ 1 name (48 B) │
├─────────────────────────────────────────┼────────────────────────────────────┤
│ ignore_user_abort() │ 1 name (48 B) + 1 value "1" (32 B) │
├─────────────────────────────────────────┼────────────────────────────────────┤
│ session_name() │ 1 name (40 B) │
├─────────────────────────────────────────┼────────────────────────────────────┤
│ session_cache_limiter() │ 1 name (48 B) │
├─────────────────────────────────────────┼────────────────────────────────────┤
│ session_cache_expire() │ 1 name (48 B) │
├─────────────────────────────────────────┼────────────────────────────────────┤
│ session_set_cookie_params() with 5 keys │ 5 names (5 × 48 B) │
├─────────────────────────────────────────┼────────────────────────────────────┤
│ Total │ 11 allocations + 11 frees, 504 B │
└─────────────────────────────────────────┴────────────────────────────────────┘
```
zend_restore_ini_entry() now deletes from EG(modified_ini_directives) by the interned entry name
instead of the caller-provided name.