# $phar->isWritable() works now too

- Thread: https://externals.io/message/36914
- Original archive: https://news-web.php.net/php.internals/36914
- Started by Gregory Beaver on 2008-04-10T03:35:46+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #36914 — Gregory Beaver — 2008-04-10T03:35:46+00:00

URL: https://externals.io/message/36914#36914

Hi,

I re-read the messages, and realized I had misunderstood what was being
requested, although it did pay off in finding a subtle bug in
 `is_writeable()` for files within a phar.

I just implemented Phar->isWritable(), which can be used to detect the
right combination of file permissions, archive type, and phar.readonly
for creating archives.  Thus, this can be used:

<?php
$phar = new Phar('blah.phar');
if ($phar->isWritable()) {
    // add files or other modifications
}
?>

This should satisfy Elizabeth's wishlist, so to satisfy Lars and
Benjamin, we need to clean up the conversion/compression API.

Greg
