PHP Embed SAPI not saving and restoring signal handlers.
Personne n'a encore pris cette issue.
- Langage dominant
- C
- Étoiles
- 40.4k
- Forks
- 8.1k
- Merge moyen
- 2 j 13 h
- PR mergées (30 j)
- 96
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par les macros PHP_EMBED_START_BLOCK() et PHP_EMBED_END_BLOCK() et suivez la manière dont zend_signal_handler et le defer handler sont installés et supprimés. Comparez l’état des signaux avant et après un bloc d’intégration ; le travail est considéré comme terminé lorsque les gestionnaires de signaux et le traitement différé des signaux sont restaurés pour le processus environnant après PHP_EMBED_END_BLOCK().
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- c, php
- Domaine
- backend, operating-systems
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100