export go_get_custom_php_ini
(disableTimeouts C.bool)
| 184 | |
| 185 | //export go_get_custom_php_ini |
| 186 | func go_get_custom_php_ini(disableTimeouts C.bool) *C.char { |
| 187 | if mainThread.phpIni == nil { |
| 188 | mainThread.phpIni = make(map[string]string) |
| 189 | } |
| 190 | |
| 191 | // Timeouts are currently fundamentally broken |
| 192 | // with ZTS except on Linux and FreeBSD: https://bugs.php.net/bug.php?id=79464 |
| 193 | // Disable timeouts if ZEND_MAX_EXECUTION_TIMERS is not supported |
| 194 | if disableTimeouts { |
| 195 | mainThread.phpIni["max_execution_time"] = "0" |
| 196 | mainThread.phpIni["max_input_time"] = "-1" |
| 197 | } |
| 198 | |
| 199 | // Pass the php.ini overrides to PHP before startup |
| 200 | // TODO: if needed this would also be possible on a per-thread basis |
| 201 | var overrides strings.Builder |
| 202 | |
| 203 | // 32 is an over-estimate for php.ini settings |
| 204 | overrides.Grow(len(mainThread.phpIni) * 32) |
| 205 | for k, v := range mainThread.phpIni { |
| 206 | overrides.WriteString(k) |
| 207 | overrides.WriteByte('=') |
| 208 | overrides.WriteString(v) |
| 209 | overrides.WriteByte('\n') |
| 210 | } |
| 211 | |
| 212 | return C.CString(overrides.String()) |
| 213 | } |
nothing calls this directly
no test coverage detected