mirror of
https://github.com/php/php-src.git
synced 2025-08-21 01:45:16 +02:00
more test coverage and fixes from increased coverage to opendir(). dir.phpt fails, but for wrong reasons (bug uncovered that needs fix)
This commit is contained in:
parent
aa3f1c0f66
commit
e69ea0731d
3 changed files with 22 additions and 2 deletions
|
@ -297,6 +297,7 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char
|
|||
uint host_len;
|
||||
|
||||
if ((resource = phar_open_url(wrapper, path, mode, options TSRMLS_CC)) == NULL) {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar url \"%s\" is unknown", path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -336,6 +337,8 @@ php_stream *phar_wrapper_open_dir(php_stream_wrapper *wrapper, char *path, char
|
|||
if (error) {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, error);
|
||||
efree(error);
|
||||
} else {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar file \"%s\" is unknown", resource->host);
|
||||
}
|
||||
php_url_free(resource);
|
||||
return NULL;
|
||||
|
@ -510,7 +513,6 @@ int phar_wrapper_mkdir(php_stream_wrapper *wrapper, char *url_from, int mode, in
|
|||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: cannot create directory \"%s\" in phar \"%s\", %s", entry.filename, phar->fname, error);
|
||||
zend_hash_del(&phar->manifest, entry.filename, entry.filename_len);
|
||||
efree(error);
|
||||
efree(entry.filename);
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
|
|
@ -50,6 +50,9 @@ echo "fwrite on dir handle\n";
|
|||
var_dump(fwrite($a, 'hi'));
|
||||
var_dump(fstat($a));
|
||||
closedir($a);
|
||||
echo "opendir edge cases\n";
|
||||
var_dump(opendir("phar://"));
|
||||
var_dump(opendir("phar://foo.phar/hi"));
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
|
@ -79,4 +82,11 @@ int(1)
|
|||
fwrite on dir handle
|
||||
int(0)
|
||||
bool(false)
|
||||
opendir edge cases
|
||||
|
||||
Warning: opendir(phar://): failed to open dir: phar error: no directory in "phar://", must have at least phar:/// for root directory (always use full path to a new phar) in %s027.php on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: opendir(phar://foo.phar/hi): failed to open dir: phar url "phar://foo.phar/hi" is unknown in %s027.php on line %d
|
||||
bool(false)
|
||||
===DONE===
|
||||
|
|
|
@ -28,12 +28,17 @@ clearstatcache();
|
|||
var_dump(file_exists($pname . '/another/dir/'));
|
||||
var_dump(file_exists($pname2 . '/test/'));
|
||||
var_dump(file_exists($pname3 . '/another/dir/'));
|
||||
ini_set('phar.readonly', 1);
|
||||
mkdir($pname . '/fails');
|
||||
ini_set('phar.readonly', 0);
|
||||
mkdir('phar://oops.phar/fails');
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
|
||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.1.phar.php'); ?>
|
||||
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.2.phar.php'); ?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
@ -41,3 +46,6 @@ bool(true)
|
|||
bool(false)
|
||||
bool(true)
|
||||
bool(false)
|
||||
|
||||
Warning: mkdir(): phar error: cannot create directory "phar://%sdir.phar.php/fails", write operations disabled in %sdir.php on line %d
|
||||
===DONE===
|
Loading…
Add table
Add a link
Reference in a new issue