mirror of
https://github.com/php/php-src.git
synced 2025-08-21 01:45:16 +02:00
add error message on attempt to rmdir/mkdir 'phar://', add to test
This commit is contained in:
parent
2c0e0e1a96
commit
e7cbf4ddfe
2 changed files with 9 additions and 0 deletions
|
@ -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 */
|
/* 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)) {
|
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;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
|
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 */
|
/* 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)) {
|
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;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
|
if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
|
||||||
|
|
|
@ -39,6 +39,9 @@ mkdir('phar://' . dirname(__FILE__) . '/ok.phar/sub');
|
||||||
mkdir('phar://' . dirname(__FILE__) . '/ok.phar/sub/directory.txt');
|
mkdir('phar://' . dirname(__FILE__) . '/ok.phar/sub/directory.txt');
|
||||||
file_put_contents(dirname(__FILE__) . '/oops.phar', '<?php this should screw em up __HALT_COMPILER();');
|
file_put_contents(dirname(__FILE__) . '/oops.phar', '<?php this should screw em up __HALT_COMPILER();');
|
||||||
mkdir('phar://' . dirname(__FILE__) . '/oops.phar/fails');
|
mkdir('phar://' . dirname(__FILE__) . '/oops.phar/fails');
|
||||||
|
|
||||||
|
mkdir('phar://');
|
||||||
|
rmdir('phar://');
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--CLEAN--
|
--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(): 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(): 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===
|
===DONE===
|
Loading…
Add table
Add a link
Reference in a new issue