From e7cbf4ddfee951f68273edb1adbb9040ea29011f Mon Sep 17 00:00:00 2001 From: Greg Beaver Date: Mon, 14 Apr 2008 16:04:11 +0000 Subject: [PATCH] add error message on attempt to rmdir/mkdir 'phar://', add to test --- ext/phar/dirstream.c | 2 ++ ext/phar/tests/dir.phpt | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c index 90e1818377..bdcd3406a9 100644 --- a/ext/phar/dirstream.c +++ b/ext/phar/dirstream.c @@ -412,6 +412,7 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, in /* pre-readonly check, we need to know if this is a data phar */ if (FAILURE == phar_split_fname(url_from, strlen(url_from), &arch, &arch_len, &entry2, &entry_len TSRMLS_CC)) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\", no phar archive specified", url_from); return FAILURE; } if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) { @@ -536,6 +537,7 @@ int phar_wrapper_rmdir(php_stream_wrapper *wrapper, char *url, int options, php_ /* pre-readonly check, we need to know if this is a data phar */ if (FAILURE == phar_split_fname(url, strlen(url), &arch, &arch_len, &entry2, &entry_len TSRMLS_CC)) { + php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot remove directory \"%s\", no phar archive specified", url); return FAILURE; } if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) { diff --git a/ext/phar/tests/dir.phpt b/ext/phar/tests/dir.phpt index 31cf25884a..0f0e03f0f2 100644 --- a/ext/phar/tests/dir.phpt +++ b/ext/phar/tests/dir.phpt @@ -39,6 +39,9 @@ mkdir('phar://' . dirname(__FILE__) . '/ok.phar/sub'); mkdir('phar://' . dirname(__FILE__) . '/ok.phar/sub/directory.txt'); file_put_contents(dirname(__FILE__) . '/oops.phar', ' ===DONE=== --CLEAN-- @@ -65,4 +68,8 @@ Warning: mkdir(): phar error: cannot create directory "sub" in phar "%sok.phar", Warning: mkdir(): phar error: cannot create directory "sub/directory.txt" in phar "%sok.phar", phar error: path "sub/directory.txt" exists and is a not a directory in %sdir.php on line %d Warning: mkdir(): internal corruption of phar "%soops.phar" (truncated manifest at stub end) in %sdir.php on line %d + +Warning: mkdir(): phar error: cannot create directory "phar://", no phar archive specified in %sdir.php on line %d + +Warning: rmdir(): phar error: cannot remove directory "phar://", no phar archive specified in %sdir.php on line %d ===DONE=== \ No newline at end of file -- 2.50.1