proc_open inaccessible cwd behavior change in 8.3
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 40.4k
- Fork
- 8.1k
- Merge medio
- 2g 13h
- PR unite (30g)
- 96
Descrizione
Description
As of PHP8.3, the following code:
<?php
$descriptorspec = array();
$cwd = '/inaccessible/dir/';
$process = proc_open('/usr/bin/env php -r ""', $descriptorspec, $pipes, $cwd);
proc_close($process);
Resulted in this output:
PHP Warning: proc_open(): posix_spawn() failed: No such file or directory in /home/hans/test/test.php on line 4
PHP Fatal error: Uncaught TypeError: proc_close(): Argument #1 ($process) must be of type resource, false given in /home/hans/test/test.php:5
Stack trace:
#0 /home/hans/test/test.php(5): proc_close()
#1 {main}
thrown in /home/hans/test/test.php on line 5
But in PHP<8.3, it results in no output whatsoever, and proc_open succeeds.
This behavior change breaks real code in the wild: https://github.com/chrome-php/wrench/pull/20
While I think the behavior change is good, I also think a E_DEPRECATED period is warranted, something like
Requesting an inaccessible working dir ($cwd) has been deprecated and will stop working in a future version of PHP
- Also for some unknown reason, when I test this locally, i get the posix_spawn() error, but when I test on Github CI, i don't get the posix_spawn() error (but proc_open() still fails.. silently.)
PHP Version
PHP8.3.0
Operating System
Ubuntu (both 22.04 and 24.04-beta)
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Iniziare eseguendo la riproduzione fornita di proc_open() e proc_close() su Ubuntu con PHP 8.3, usando il cwd inaccessibile e confrontando i risultati locali con quelli di GitHub CI. Tracciare il comportamento di proc_open() in relazione al fallimento di posix_spawn(), quindi definire il comportamento previsto in caso di deprecazione o fallimento e aggiungere la copertura per i diversi risultati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, php
- Ambito
- operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100