PHP Embed SAPI not saving and restoring signal handlers.
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C
- Estrellas
- 40.4k
- Forks
- 8.1k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 96
Descripción
Description
I would expect the the execution context to be restored following the PHP_EMBED_END_BLOCK() macro, but this doesn't seem to be the case for signal handlers.
here is a toy function to call a php function from a specified file:
/* Early work to call a php function from a specified script file */
void
call_php_function(char *file_name, char *function_name)
{
zend_file_handle file_handle;
zval retval = {0};
zend_fcall_info fci = {0};
zend_fcall_info_cache fci_cache = {0};
sigset_t oldsigset;
struct sigaction oldsigaction[32] = {0,};
some_signal_save_function(&oldsigset, oldsigaction);
PHP_EMBED_START_BLOCK(0, NULL)
zend_stream_init_filename(&file_handle, file_name);
php_execute_script(&file_handle);
ZVAL_STRING(&fci.function_name, function_name);
fci.size = sizeof fci;
fci.retval = &retval;
zend_call_function(&fci, &fci_cache);
PHP_EMBED_END_BLOCK()
some_signal_restore_function(&oldsigset, oldsigaction);
}
Without the signal save/restore wrapping the embed block, the zend_signal_handler and defer handler is still handling the dispatching of signals, which is likely not what a user would want once outside an embed block.
PHP Version
7.4.27
Operating System
No response
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con las macros PHP_EMBED_START_BLOCK() y PHP_EMBED_END_BLOCK() y sigue cómo se instalan y eliminan zend_signal_handler y el defer handler. Compara el estado de las señales antes y después de un bloque embebido; se considera terminado cuando los manejadores de señales y el procesamiento diferido de señales se restauran para el proceso envolvente después de PHP_EMBED_END_BLOCK().
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c, php
- Área
- backend, operating-systems
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100