3v4l.org

run code in 200+ PHP versions simultaneously
<?php var_dump(decoct(umask())); $sFile = tempnam('/tmp', 'test'); var_dump(decoct(stat($sFile)['mode'])); $phar = new \PharData('/tmp/test.tar', null, null, \Phar::TAR); $phar->addFile($sFile, 'test-file-phar'); $phar->extractTo('/tmp/'); var_dump(decoct(stat('/tmp/test-file-phar')['mode']));
based on EMR4U
Output for 7.0.33, 7.2.13 - 7.3.1
string(2) "22" string(6) "100600" string(6) "100600"
Output for 5.6.38 - 7.0.28, 7.1.0 - 7.1.24, 7.2.0 - 7.2.12
string(2) "22" string(6) "100600" string(6) "100666"
Output for 7.1.25
string(2) "22" string(6) "100600" Fatal error: Uncaught PharException: Extraction from phar "/tmp/test.tar" failed: Cannot extract "test-file-phar" to "/tmp//test-file-phar", path already exists in /in/PO3hN:10 Stack trace: #0 /in/PO3hN(10): PharData->extractTo('/tmp/') #1 {main} thrown in /in/PO3hN on line 10
Process exited with code 255.