Bug #79121 [NEW]: is_writable not working for path in phar archive, regardless of phar.readonly
| From: | alex at 1stleg dot com | Date: | Wed, 15 Jan 2020 17:11:16 +0000 |
| Subject: | Bug #79121 [NEW]: is_writable not working for path in phar archive, regardless of phar.readonly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224915@lists.php.net to get a copy of this message | ||
From: alex at 1stleg dot com
Operating system: Ubuntu 18.04.3 LTS
PHP version: 7.2.26
Package: PHAR related
Bug Type: Bug
Bug description:is_writable not working for path in phar archive, regardless of phar.readonly
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 bug report at https://bugs.php.net/bug.php?id=79121&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79121&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79121&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79121&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79121&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79121&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79121&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79121&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79121&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79121&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79121&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79121&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79121&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79121&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79121&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79121&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79121&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79121&r=mysqlcfg