php / php/php-src

Closing PDO descriptors for child processes

Aperta
#20,084 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Extension: pdo (core) Feature Status: Needs Triage
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con PDO::setAttribute() e i percorsi dei processi Unix indicati nell’issue: shell_exec(), passthru(), proc_open() e pcntl_fork(). Determina in che modo le connessioni PDO espongono o ereditano i descrittori e definisci la copertura per il comportamento richiesto; il lavoro è completato quando l’impostazione supportata impedisce l’ereditarietà dove applicabile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c, php
Ambito
backend, databases
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.