realpath() and SplFileInfo::getRealPath inside Phar
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
I'm trying to include packages in my phar but many of them use realpath to files inside the Phar which spits out false instead of a path; breaking things. If the behavior was to return the same path when the path starts with phar:// it would just work.
The following code:
make_phar.php
<?php
$phar = new Phar('test.phar');
$phar->addFile('test.php');
$phar->setDefaultStub('test.php');
$phar->stopBuffering();
test.php
<?php
var_dump(
__FILE__,
realpath(__FILE__),
(new SplFileInfo(__FILE__))->getRealPath(),
);
php test.php && php make_phar.php && php test.phar
Resulted in this output:
string(45) "/home/murrant/projects/realpath_test/test.php"
string(45) "/home/murrant/projects/realpath_test/test.php"
string(45) "/home/murrant/projects/realpath_test/test.php"
string(62) "phar:///home/murrant/projects/realpath_test/test.phar/test.php"
bool(false)
bool(false)
But I expected this output instead:
string(45) "/home/murrant/projects/realpath_test/test.php"
string(45) "/home/murrant/projects/realpath_test/test.php"
string(45) "/home/murrant/projects/realpath_test/test.php"
string(62) "phar:///home/murrant/projects/realpath_test/test.phar/test.php"
string(62) "phar:///home/murrant/projects/realpath_test/test.phar/test.php"
string(62) "phar:///home/murrant/projects/realpath_test/test.phar/test.php"
PHP Version
PHP 8.3.7
Operating System
No response
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
Inizia eseguendo make_phar.php, test.php e il comando php test.phar fornito per riprodurre i risultati errati di realpath() e SplFileInfo::getRealPath(). Traccia la gestione del filesystem di PHP e Phar coinvolta in queste chiamate. Il lavoro è completo quando entrambe le funzioni restituiscono il percorso phar:// mostrato nell'output previsto, lasciando invariati i risultati esistenti non relativi a Phar.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100