]> granicus.if.org Git - php/commitdiff
- Improved fix
authorFelipe Pena <felipe@php.net>
Tue, 26 Aug 2008 16:19:29 +0000 (16:19 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 26 Aug 2008 16:19:29 +0000 (16:19 +0000)
ext/fileinfo/fileinfo.c
ext/fileinfo/tests/finfo_file_001.phpt

index 0824ef1a96222393877b1ef44c0d1537178f812a..475169166a96d5fa8278f3f20a95229907ebe69e 100644 (file)
@@ -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;
index 6ef8e27863845f206da31ce10b4747b492cdefbc..1cffa3b2f1834f376635df7b27d3b4bc6ef91ffc 100644 (file)
@@ -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)