]> granicus.if.org Git - php/commitdiff
add error message on attempt to rmdir/mkdir 'phar://', add to test
authorGreg Beaver <cellog@php.net>
Mon, 14 Apr 2008 16:04:11 +0000 (16:04 +0000)
committerGreg Beaver <cellog@php.net>
Mon, 14 Apr 2008 16:04:11 +0000 (16:04 +0000)
ext/phar/dirstream.c
ext/phar/tests/dir.phpt

index 90e18183778d51164cc24807b1d82694a193f6e0..bdcd3406a97a2ab47486bfe656788fed4f385af4 100644 (file)
@@ -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)) {
index 31cf25884a3f51f9fe8358a3b759c69d37027480..0f0e03f0f24249f81db08d513135d90a9ed5f46f 100644 (file)
@@ -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', '<?php this should screw em up __HALT_COMPILER();');
 mkdir('phar://' . dirname(__FILE__) . '/oops.phar/fails');
+
+mkdir('phar://');
+rmdir('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