diff options
author | Felipe Pena <felipe@php.net> | 2008-08-26 16:22:27 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2008-08-26 16:22:27 +0000 |
commit | d8c43bde790c48ed44bcac109a206c5249c03352 (patch) | |
tree | b91f00843b73b69eef1a94f6d9c792e0491d1827 | |
parent | 9f6848373421ea9ff81f41f3b5b6eaf0a797fa60 (diff) | |
download | php-git-d8c43bde790c48ed44bcac109a206c5249c03352.tar.gz |
- MFH: Improved fix
-rw-r--r-- | ext/fileinfo/fileinfo.c | 4 | ||||
-rw-r--r-- | ext/fileinfo/tests/finfo_file_001.phpt | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 1e9c49e346..d3928c80a3 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -402,7 +402,7 @@ PHP_FUNCTION(finfo_set_flags) static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ { long options = 0; - char *buffer, *tmp, *ret_val; + char *tmp, *ret_val, *buffer = NULL; int buffer_len; struct php_fileinfo *finfo; zval *zfinfo, *zcontext = NULL; @@ -449,7 +449,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ * } else { /* local file */ char resolved_path[MAXPATHLEN]; - if (buffer_len && VCWD_REALPATH(buffer, resolved_path)) { + if (*buffer && VCWD_REALPATH(buffer, resolved_path)) { ret_val = (char *) magic_file(finfo->magic, buffer); } else { RETURN_FALSE; diff --git a/ext/fileinfo/tests/finfo_file_001.phpt b/ext/fileinfo/tests/finfo_file_001.phpt index 6ef8e27863..1cffa3b2f1 100644 --- a/ext/fileinfo/tests/finfo_file_001.phpt +++ b/ext/fileinfo/tests/finfo_file_001.phpt @@ -4,6 +4,7 @@ finfo_file(): Testing file names <?php $fp = finfo_open(); +var_dump(finfo_file($fp, "\0")); var_dump(finfo_file($fp, '')); var_dump(finfo_file($fp, NULL)); var_dump(finfo_file($fp, '.')); @@ -13,5 +14,6 @@ var_dump(finfo_file($fp, '&')); --EXPECT-- bool(false) bool(false) +bool(false) string(9) "directory" bool(false) |