From: Greg Beaver Date: Fri, 25 Apr 2008 15:53:02 +0000 (+0000) Subject: new code coverage test, improve clarity of error message when chmod is used on a... X-Git-Tag: RELEASE_2_0_0b1~210 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13dc477de2f8e05e0d38bdeb6a42969bb8fb19f0;p=php new code coverage test, improve clarity of error message when chmod is used on a temp directory --- diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 0d01c57c3e..c48bd9697c 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -3513,7 +3513,7 @@ PHP_METHOD(PharFileInfo, chmod) 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) { diff --git a/ext/phar/tests/pharfileinfo_chmod.phpt b/ext/phar/tests/pharfileinfo_chmod.phpt new file mode 100644 index 0000000000..b0b31b8f53 --- /dev/null +++ b/ext/phar/tests/pharfileinfo_chmod.phpt @@ -0,0 +1,35 @@ +--TEST-- +Phar: PharFileInfo::chmod extra code coverage +--SKIPIF-- + + + +--INI-- +phar.readonly=0 +--FILE-- +chmod(066); +} catch (Exception $e) { +echo $e->getMessage(), "\n"; +} +$b->chmod(array()); +lstat($pname . '/a/b'); // sets BG(CurrentLStatFile) +$b->chmod(0666); +?> +===DONE=== +--CLEAN-- + +--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