|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-01-15 17:11 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
Try defining the full path. $path = '.'; if (!empty($pharPath = \Phar::running(false))) { $path = dirname($pharPath); } $this->fileSystem->dumpFile( $path.'/testfile.txt', 'my test content' ); (https://www.myhealthatvanderbilt.net/)github.com