if (entry_obj->ent.entry->is_temp_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
- "Phar entry is a directory, cannot chmod"); \
+ "Phar entry \"%s\" is a temporary directory (not an actual entry in the archive), cannot chmod", entry_obj->ent.entry->filename); \
return;
}
if (PHAR_G(readonly) && !entry_obj->ent.entry->phar->is_data) {
--- /dev/null
+--TEST--
+Phar: PharFileInfo::chmod extra code coverage
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("zlib")) die("skip no zlib"); ?>
+<?php if (!extension_loaded("bz2")) die("skip no bz2"); ?>
+--INI--
+phar.readonly=0
+--FILE--
+<?php
+$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
+$pname = 'phar://' . $fname;
+
+$phar = new Phar($fname);
+
+$phar['a/b'] = 'hi there';
+
+$b = $phar['a/b'];
+try {
+$phar['a']->chmod(066);
+} catch (Exception $e) {
+echo $e->getMessage(), "\n";
+}
+$b->chmod(array());
+lstat($pname . '/a/b'); // sets BG(CurrentLStatFile)
+$b->chmod(0666);
+?>
+===DONE===
+--CLEAN--
+<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
+--EXPECTF--
+Phar entry "a" is a temporary directory (not an actual entry in the archive), cannot chmod
+
+Warning: PharFileInfo::chmod() expects parameter 1 to be long, array given in %spharfileinfo_chmod.php on line %d
+===DONE===
\ No newline at end of file