File descriptors / some procfs entries not openable by php
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C
- Sterne
- 40.4k
- Forks
- 8.1k
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 96
Beschreibung
Description
The following code:
<?php
file_put_contents("/proc/1/fd/1", "hi");
Resulted in this output:
file_put_contents(/proc/1/fd/1): failed to open stream: No such file or directory
But I expected this output instead:
2
This is highly impactful for containerized PHP environments. php-fpm has unique workarounds that they've utilized, and in the past the fd stream wrapper was implemented to support managing the current process's file descriptors, but if you are in a different SAPI and/or utilize forking or execing to other PHP scripts, stdout in a docker container quickly turns into a black hole in terms of container logging, where it's expected that all logs are sent to the PID 1 stdout/err. See: https://bugs.php.net/bug.php?id=53465 where they hypothesize this is due to PHP incorrectly attempts to dereference the pseudo-symlink before opening it. The hypothesis makes sense to me. It'd be nice to see this fixed for all file descriptors.
PHP Version
7.4
Operating System
Centos 7.9
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Es wird keine Quelldatei oder kein Test genannt. Beginne damit, das PHP-Beispiel gegen /proc/1/fd/1 zu reproduzieren und den verlinkten Bug zum Dereferenzieren von Pseudo-Symlinks zu lesen; verfolge dann den Pfad zum Öffnen von Dateien für procfs-Deskriptoren. Als erledigt gilt dies, wenn Deskriptoren wie /proc/1/fd/1 geöffnet werden können und über alle SAPIs hinweg das erwartete Ergebnis liefern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- c, php
- Bereich
- operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100