diff options
author | Pierre Joye <pajoye@php.net> | 2010-05-04 08:48:58 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2010-05-04 08:48:58 +0000 |
commit | cdadeed834c748c63cb0e71f34597d51690dd9fe (patch) | |
tree | 37c7dca6e1c79300733ab8702c85308798869bb4 | |
parent | 331b052994d4b21ddae66f685fbd1c77ea2e6f6f (diff) | |
download | php-git-cdadeed834c748c63cb0e71f34597d51690dd9fe.tar.gz |
- Fixed bug #51732, Fileinfo __construct or open does not work with NULL
-rw-r--r-- | ext/fileinfo/fileinfo.c | 4 | ||||
-rw-r--r-- | ext/fileinfo/tests/finfo_open_001.phpt | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 75862e7e52..81ee428e94 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -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; } diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt index 0223a381cb..69696ebe33 100644 --- a/ext/fileinfo/tests/finfo_open_001.phpt +++ b/ext/fileinfo/tests/finfo_open_001.phpt @@ -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) |