]> granicus.if.org Git - php/commitdiff
- Fixed bug #51732, Fileinfo __construct or open does not work with NULL
authorPierre Joye <pajoye@php.net>
Tue, 4 May 2010 08:48:58 +0000 (08:48 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 4 May 2010 08:48:58 +0000 (08:48 +0000)
NEWS
ext/fileinfo/fileinfo.c
ext/fileinfo/tests/finfo_open_001.phpt

diff --git a/NEWS b/NEWS
index dc0b20bfd73612b1eefb835bc9f42c8ab08efb48..0bde7a7e95cac46c83d69df7c05c861d6a9520a1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -39,6 +39,8 @@ PHP                                                                        NEWS
   requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert)
 - Fixed 64-bit integer overflow in mhash_keygen_s2k(). (ClĂ©ment LECIGNE, Stas)
 
+- Fixed bug #51732 (Fileinfo __construct or open does not work with NULL).
+  (Pierre)
 - Fixed bug #51723 (Content-length header is limited to 32bit integer with
   Apache2 on Windows). (Pierre)
 - Fixed bug #51690 (Phar::setStub looks for case-sensitive
index 75862e7e525736e2cf5807542a82700c571e364a..81ee428e943234ef86f418b7475d500073b302b3 100644 (file)
@@ -291,7 +291,9 @@ PHP_FUNCTION(finfo_open)
                RETURN_FALSE;
        }
 
-       if (file && *file) { /* user specified file, perform open_basedir checks */
+       if (file_len == 0) {
+               file = NULL;
+       } else if (file && *file) { /* user specified file, perform open_basedir checks */
                if (!VCWD_REALPATH(file, resolved_path)) {
                        RETURN_FALSE;
                }
index 0223a381cb56aee4359fbab29e059c1afb204197..69696ebe332ee25c1d832fc22d2055b34cb8a71a 100644 (file)
@@ -16,12 +16,8 @@ var_dump(finfo_open(FILEINFO_MIME, '/foo/bar/inexistent'));
 --EXPECTF--
 Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
 bool(false)
-
-Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
-bool(false)
-
-Warning: finfo_open(): Failed to load magic database at ''. in %s on line %d
-bool(false)
+resource(%d) of type (file_info)
+resource(%d) of type (file_info)
 bool(false)
 bool(false)
 bool(false)