Bug #79121 [Com]: is_writable not working for path in phar archive, regardless of phar.readonly

From: Date: Wed, 22 Jan 2020 17:47:44 +0000
Subject: Bug #79121 [Com]: is_writable not working for path in phar archive, regardless of phar.readonly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225045@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79121&edit=1 ID: 79121 Comment by: alex at 1stleg dot com Reported by: alex at 1stleg dot com Summary: is_writable not working for path in phar archive, regardless of phar.readonly Status: Open Type: Bug Package: PHAR related Operating System: Ubuntu 18.04.3 LTS PHP Version: 7.2.26 Block user comment: N Private report: N New Comment: Just to further add to this: var_dump($configDir, is_dir($configDir), is_readable($configDir), realpath($configDir), scandir($configDir)); string(8) "./config" bool(true) bool(true) bool(false) bool(false) Needless to say, I am not very excited about these issues. Previous Comments: ------------------------------------------------------------------------ [2020-01-15 17:11:16] alex at 1stleg dot com Description: ------------ is_writable seems to be incapable of detecting if a path within a phar archive can be written to. Test script: --------------- pharstub.php <?php Phar::interceptFileFuncs(); set_include_path("phar://archive.phar" . PATH_SEPARATOR . get_include_path()); include "public/index.php"; __HALT_COMPILER(); public/index.php <?php if (is_writable("phar://archive.phar/folder")) { die("yes"); } else { die("no"); } create-phar.php #!/bin/env php <?php $phar = new Phar('archive.phar'); $phar->addEmptyDir('folder/'); $phar->buildFromIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator("public/", FilesystemIterator::SKIP_DOTS)), "."); $phar->setStub(file_get_contents("pharstub.php")); $phar->compressFiles(Phar::GZ); Expected result: ---------------- I would expect that is_writable will return true under some circumstance for folders within a phar. Currently it will return false regardless of phar.readonly = off or chmod 0777 of the internal folder or chmod 0777 of the phar archive. Actual result: -------------- Phar does not appear to be ready for production, or really anything outside of a novelty application. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79121&edit=1

« previous php.bugs (#225045) next »