Closing PDO descriptors for child processes
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
At least on Unix systems, whenever PHP creates a child process, whether through conventional means like shell_exec(), passthru(), or proc_open(), or through stuff like pcntl_fork(), the child process inherits all of the open file descriptors, including any open authenticated PDO database connections.
This is generally not desirable. Even in contexts where it's not a security concern, two processes should not share one connection to a database because the first one to use it will mess it up for the other one.
In other languages, this is avoided by calling something like:
fcntl( fd, F_SETFD, F_CLOEXEC );
on the database's file handle. But PHP doesn't provide this functionality (that I'm aware of) without exotic extensions and even if it did, there's no way (that I'm aware of) to get at the system file descriptor corresponding to a PDO connection.
Would it be possible/reasonable to add something to PDO::setAttribute() that would, when invoked, set that flag on the underlying descriptor where it is applicable?
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 PDO::setAttribute() et les chemins de processus Unix nommés dans l’issue : shell_exec(), passthru(), proc_open() et pcntl_fork(). Déterminez comment les connexions PDO exposent ou héritent des descripteurs et définissez la couverture pour le comportement demandé ; le travail est terminé lorsque le paramètre pris en charge empêche l’héritage lorsque cela s’applique.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- c, php
- Domaine
- backend, databases
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 25/100