Commit d1428af
Simplify per-thread PHP init - ThreadScope only, remove Sapi::startup()
The previous approach of calling php_module_startup() per-request caused
assertion failures in zend_new_interned_string_permanent when called
concurrently from multiple threads.
PHP's architecture uses:
- php_module_startup() once during SAPI init (global state, interned strings)
- ts_resource(0) per-thread to initialize TSRM thread-local storage
The fix:
- Keep php_module_startup() as one-time call in Sapi::new() on main thread
- ThreadScope calls ext_php_rs_sapi_per_thread_init() which calls ts_resource(0)
- Remove Sapi::startup() that was calling php_module_startup() per-request
This properly separates global initialization from per-thread TLS setup.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 2561124 commit d1428af
3 files changed
+4
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
345 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
346 | 347 | | |
347 | 348 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | 349 | | |
355 | 350 | | |
356 | 351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | 117 | | |
136 | 118 | | |
137 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| |||
0 commit comments