Back to index

php5  5.3.10
fileinfo.c
Go to the documentation of this file.
00001 /*
00002   +----------------------------------------------------------------------+
00003   | PHP Version 5                                                        |
00004   +----------------------------------------------------------------------+
00005   | Copyright (c) 1997-2012 The PHP Group                                |
00006   +----------------------------------------------------------------------+
00007   | This source file is subject to version 3.0 of the PHP license,       |
00008   | that is bundled with this package in the file LICENSE, and is        |
00009   | available through the world-wide-web at the following url:           |
00010   | http://www.php.net/license/3_0.txt.                                  |
00011   | If you did not receive a copy of the PHP license and are unable to   |
00012   | obtain it through the world-wide-web, please send a note to          |
00013   | license@php.net so we can mail you a copy immediately.               |
00014   +----------------------------------------------------------------------+
00015   | Author: Ilia Alshanetsky <ilia@php.net>                              |
00016   +----------------------------------------------------------------------+
00017 */
00018 
00019 /* $Id: fileinfo.c 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #ifdef HAVE_CONFIG_H
00022 #include "config.h"
00023 #endif
00024 #include "php.h"
00025 
00026 #include <magic.h>
00027 /* 
00028  * HOWMANY specifies the maximum offset libmagic will look at
00029  * this is currently hardcoded in the libmagic source but not exported
00030  */
00031 #ifndef HOWMANY
00032 #define HOWMANY 65536
00033 #endif
00034 
00035 #include "php_ini.h"
00036 #include "ext/standard/info.h"
00037 #include "ext/standard/file.h" /* needed for context stuff */
00038 #include "php_fileinfo.h"
00039 #include "fopen_wrappers.h" /* needed for is_url */
00040 
00041 #ifndef _S_IFDIR
00042 # define _S_IFDIR           S_IFDIR
00043 #endif
00044 
00045 /* {{{ macros and type definitions */
00046 struct php_fileinfo {
00047        long options;
00048        struct magic_set *magic;
00049 };
00050 
00051 static zend_object_handlers finfo_object_handlers;
00052 zend_class_entry *finfo_class_entry;
00053 
00054 struct finfo_object {
00055        zend_object zo;
00056        struct php_fileinfo *ptr;
00057 };
00058 
00059 #define FILEINFO_DECLARE_INIT_OBJECT(object) \
00060        zval *object = getThis();
00061 
00062 #define FILEINFO_REGISTER_OBJECT(_object, _ptr) \
00063 { \
00064        struct finfo_object *obj; \
00065         obj = (struct finfo_object*)zend_object_store_get_object(_object TSRMLS_CC); \
00066         obj->ptr = _ptr; \
00067 }
00068 
00069 #define FILEINFO_FROM_OBJECT(finfo, object) \
00070 { \
00071        struct finfo_object *obj = zend_object_store_get_object(object TSRMLS_CC); \
00072        finfo = obj->ptr; \
00073        if (!finfo) { \
00074               php_error_docref(NULL TSRMLS_CC, E_WARNING, "The invalid fileinfo object."); \
00075               RETURN_FALSE; \
00076        } \
00077 }
00078 
00079 /* {{{ finfo_objects_dtor
00080  */
00081 static void finfo_objects_dtor(void *object, zend_object_handle handle TSRMLS_DC)
00082 {
00083        struct finfo_object *intern = (struct finfo_object *) object;
00084 
00085        if (intern->ptr) {
00086               magic_close(intern->ptr->magic);
00087               efree(intern->ptr);
00088        }
00089 
00090        zend_object_std_dtor(&intern->zo TSRMLS_CC);
00091        efree(intern);
00092 }
00093 /* }}} */
00094 
00095 /* {{{ finfo_objects_new
00096  */
00097 PHP_FILEINFO_API zend_object_value finfo_objects_new(zend_class_entry *class_type TSRMLS_DC)
00098 {
00099        zend_object_value retval;
00100        struct finfo_object *intern;
00101        zval *tmp;
00102 
00103        intern = emalloc(sizeof(struct finfo_object));
00104        memset(intern, 0, sizeof(struct finfo_object));
00105 
00106        zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
00107        zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *));
00108 
00109        intern->ptr = NULL;
00110 
00111        retval.handle = zend_objects_store_put(intern, finfo_objects_dtor, NULL, NULL TSRMLS_CC);
00112        retval.handlers = (zend_object_handlers *) &finfo_object_handlers;
00113 
00114        return retval;
00115 }
00116 /* }}} */
00117 
00118 /* {{{ arginfo */
00119 ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_open, 0, 0, 0)
00120        ZEND_ARG_INFO(0, options)
00121        ZEND_ARG_INFO(0, arg)
00122 ZEND_END_ARG_INFO()
00123 
00124 ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_close, 0, 0, 1)
00125        ZEND_ARG_INFO(0, finfo)
00126 ZEND_END_ARG_INFO()
00127 
00128 ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_set_flags, 0, 0, 2)
00129        ZEND_ARG_INFO(0, finfo)
00130        ZEND_ARG_INFO(0, options)
00131 ZEND_END_ARG_INFO()
00132 
00133 ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_set_flags, 0, 0, 1)
00134        ZEND_ARG_INFO(0, options)
00135 ZEND_END_ARG_INFO()
00136 
00137 ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_file, 0, 0, 2)
00138        ZEND_ARG_INFO(0, finfo)
00139        ZEND_ARG_INFO(0, filename)
00140        ZEND_ARG_INFO(0, options)
00141        ZEND_ARG_INFO(0, context)
00142 ZEND_END_ARG_INFO()
00143 
00144 ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_file, 0, 0, 1)
00145        ZEND_ARG_INFO(0, filename)
00146        ZEND_ARG_INFO(0, options)
00147        ZEND_ARG_INFO(0, context)
00148 ZEND_END_ARG_INFO()
00149 
00150 ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_buffer, 0, 0, 2)
00151        ZEND_ARG_INFO(0, finfo)
00152        ZEND_ARG_INFO(0, string)
00153        ZEND_ARG_INFO(0, options)
00154        ZEND_ARG_INFO(0, context)
00155 ZEND_END_ARG_INFO()
00156 
00157 ZEND_BEGIN_ARG_INFO_EX(arginfo_finfo_method_buffer, 0, 0, 1)
00158        ZEND_ARG_INFO(0, string)
00159        ZEND_ARG_INFO(0, options)
00160        ZEND_ARG_INFO(0, context)
00161 ZEND_END_ARG_INFO()
00162 
00163 ZEND_BEGIN_ARG_INFO_EX(arginfo_mime_content_type, 0, 0, 1)
00164        ZEND_ARG_INFO(0, string)
00165 ZEND_END_ARG_INFO()
00166 /* }}} */
00167 
00168 /* {{{ finfo_class_functions
00169  */
00170 zend_function_entry finfo_class_functions[] = {
00171        ZEND_ME_MAPPING(finfo,          finfo_open,     arginfo_finfo_open, ZEND_ACC_PUBLIC)
00172        ZEND_ME_MAPPING(set_flags,      finfo_set_flags,arginfo_finfo_method_set_flags, ZEND_ACC_PUBLIC)
00173        ZEND_ME_MAPPING(file,           finfo_file,     arginfo_finfo_method_file, ZEND_ACC_PUBLIC)
00174        ZEND_ME_MAPPING(buffer,         finfo_buffer,   arginfo_finfo_method_buffer, ZEND_ACC_PUBLIC)
00175        PHP_FE_END
00176 };
00177 /* }}} */
00178 
00179 #define FINFO_SET_OPTION(magic, options) \
00180        if (magic_setflags(magic, options) == -1) { \
00181               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to set option '%ld' %d:%s", \
00182                             options, magic_errno(magic), magic_error(magic)); \
00183               RETURN_FALSE; \
00184        }
00185 
00186 /* True global resources - no need for thread safety here */
00187 static int le_fileinfo;
00188 /* }}} */
00189 
00190 void finfo_resource_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
00191 {
00192        if (rsrc->ptr) {
00193               struct php_fileinfo *finfo = (struct php_fileinfo *) rsrc->ptr;
00194               magic_close(finfo->magic);
00195               efree(rsrc->ptr);
00196               rsrc->ptr = NULL;
00197        }
00198 }
00199 /* }}} */
00200 
00201 
00202 /* {{{ fileinfo_functions[]
00203  */
00204 zend_function_entry fileinfo_functions[] = {
00205        PHP_FE(finfo_open,          arginfo_finfo_open)
00206        PHP_FE(finfo_close,         arginfo_finfo_close)
00207        PHP_FE(finfo_set_flags,     arginfo_finfo_set_flags)
00208        PHP_FE(finfo_file,          arginfo_finfo_file)
00209        PHP_FE(finfo_buffer, arginfo_finfo_buffer)
00210        PHP_FE(mime_content_type, arginfo_mime_content_type)
00211        {NULL, NULL, NULL}
00212 };
00213 /* }}} */
00214 
00215 /* {{{ PHP_MINIT_FUNCTION
00216  */
00217 PHP_MINIT_FUNCTION(finfo)
00218 {
00219        zend_class_entry _finfo_class_entry;
00220        INIT_CLASS_ENTRY(_finfo_class_entry, "finfo", finfo_class_functions);
00221        _finfo_class_entry.create_object = finfo_objects_new;
00222        finfo_class_entry = zend_register_internal_class(&_finfo_class_entry TSRMLS_CC);
00223 
00224        /* copy the standard object handlers to you handler table */
00225        memcpy(&finfo_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
00226 
00227        le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
00228 
00229        REGISTER_LONG_CONSTANT("FILEINFO_NONE",                 MAGIC_NONE, CONST_CS|CONST_PERSISTENT);
00230        REGISTER_LONG_CONSTANT("FILEINFO_SYMLINK",              MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT);
00231        REGISTER_LONG_CONSTANT("FILEINFO_MIME",                 MAGIC_MIME, CONST_CS|CONST_PERSISTENT);
00232        REGISTER_LONG_CONSTANT("FILEINFO_MIME_TYPE",     MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT);
00233        REGISTER_LONG_CONSTANT("FILEINFO_MIME_ENCODING",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT);
00234 /*     REGISTER_LONG_CONSTANT("FILEINFO_COMPRESS",             MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */
00235        REGISTER_LONG_CONSTANT("FILEINFO_DEVICES",              MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT);
00236        REGISTER_LONG_CONSTANT("FILEINFO_CONTINUE",             MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT);
00237 #ifdef MAGIC_PRESERVE_ATIME
00238        REGISTER_LONG_CONSTANT("FILEINFO_PRESERVE_ATIME",       MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT);
00239 #endif
00240 #ifdef MAGIC_RAW
00241        REGISTER_LONG_CONSTANT("FILEINFO_RAW",                  MAGIC_RAW, CONST_CS|CONST_PERSISTENT);
00242 #endif
00243 
00244        return SUCCESS;
00245 }
00246 /* }}} */
00247 
00248 /* {{{ fileinfo_module_entry
00249  */
00250 zend_module_entry fileinfo_module_entry = {
00251        STANDARD_MODULE_HEADER,
00252        "fileinfo",
00253        fileinfo_functions,
00254        PHP_MINIT(finfo),
00255        NULL,
00256        NULL,  
00257        NULL,
00258        PHP_MINFO(fileinfo),
00259        PHP_FILEINFO_VERSION,
00260        STANDARD_MODULE_PROPERTIES
00261 };
00262 /* }}} */
00263 
00264 #ifdef COMPILE_DL_FILEINFO
00265 ZEND_GET_MODULE(fileinfo)
00266 #endif
00267 
00268 /* {{{ PHP_MINFO_FUNCTION
00269  */
00270 PHP_MINFO_FUNCTION(fileinfo)
00271 {
00272        php_info_print_table_start();
00273        php_info_print_table_header(2, "fileinfo support", "enabled");
00274        php_info_print_table_row(2, "version", PHP_FILEINFO_VERSION);
00275        php_info_print_table_end();
00276 }
00277 /* }}} */
00278 
00279 /* {{{ proto resource finfo_open([int options [, string arg]])
00280    Create a new fileinfo resource. */
00281 PHP_FUNCTION(finfo_open)
00282 {
00283        long options = MAGIC_NONE;
00284        char *file = NULL;
00285        int file_len = 0;
00286        struct php_fileinfo *finfo;
00287        FILEINFO_DECLARE_INIT_OBJECT(object)
00288        char resolved_path[MAXPATHLEN];
00289 
00290        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ls", &options, &file, &file_len) == FAILURE) {
00291               RETURN_FALSE;
00292        }
00293        
00294        if (object) {
00295               struct finfo_object *finfo_obj = (struct finfo_object*)zend_object_store_get_object(object TSRMLS_CC);
00296               
00297               if (finfo_obj->ptr) {
00298                      magic_close(finfo_obj->ptr->magic);
00299                      efree(finfo_obj->ptr);
00300                      finfo_obj->ptr = NULL;
00301               }
00302        }
00303 
00304        if (file_len == 0) {
00305               file = NULL;
00306        } else if (file && *file) { /* user specified file, perform open_basedir checks */
00307               if (strlen(file) != file_len) {
00308                      RETURN_FALSE;
00309               }
00310               if (!VCWD_REALPATH(file, resolved_path)) {
00311                      RETURN_FALSE;
00312               }
00313               file = resolved_path;
00314 
00315 #if PHP_API_VERSION < 20100412
00316               if ((PG(safe_mode) && (!php_checkuid(file, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(file TSRMLS_CC)) {
00317 #else
00318               if (php_check_open_basedir(file TSRMLS_CC)) {
00319 #endif
00320                      RETURN_FALSE;
00321               }
00322        }
00323 
00324        finfo = emalloc(sizeof(struct php_fileinfo));
00325 
00326        finfo->options = options;
00327        finfo->magic = magic_open(options);
00328 
00329        if (finfo->magic == NULL) {
00330               efree(finfo);
00331               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid mode '%ld'.", options);
00332               RETURN_FALSE; 
00333        }
00334 
00335        if (magic_load(finfo->magic, file) == -1) {
00336               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to load magic database at '%s'.", file);
00337               magic_close(finfo->magic);
00338               efree(finfo);
00339               RETURN_FALSE;
00340        }      
00341 
00342        if (object) {
00343               FILEINFO_REGISTER_OBJECT(object, finfo);
00344        } else {
00345               ZEND_REGISTER_RESOURCE(return_value, finfo, le_fileinfo);
00346        }      
00347 }
00348 /* }}} */
00349 
00350 /* {{{ proto resource finfo_close(resource finfo)
00351    Close fileinfo resource. */
00352 PHP_FUNCTION(finfo_close)
00353 {
00354        struct php_fileinfo *finfo;
00355        zval *zfinfo;
00356 
00357        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zfinfo) == FAILURE) {
00358               RETURN_FALSE;
00359        }
00360        ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
00361 
00362        zend_list_delete(Z_RESVAL_P(zfinfo));
00363 
00364        RETURN_TRUE;
00365 }
00366 /* }}} */
00367 
00368 /* {{{ proto bool finfo_set_flags(resource finfo, int options)
00369    Set libmagic configuration options. */
00370 PHP_FUNCTION(finfo_set_flags)
00371 {
00372        long options;
00373        struct php_fileinfo *finfo;
00374        zval *zfinfo;
00375        FILEINFO_DECLARE_INIT_OBJECT(object)
00376 
00377        if (object) {
00378               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &options) == FAILURE) {
00379                      RETURN_FALSE;
00380               }
00381               FILEINFO_FROM_OBJECT(finfo, object);
00382        } else {
00383               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zfinfo, &options) == FAILURE) {
00384                      RETURN_FALSE;
00385               }
00386               ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
00387        }
00388 
00389        FINFO_SET_OPTION(finfo->magic, options)
00390        finfo->options = options;
00391 
00392        RETURN_TRUE;
00393 }
00394 /* }}} */
00395 
00396 #define FILEINFO_MODE_BUFFER 0
00397 #define FILEINFO_MODE_STREAM 1
00398 #define FILEINFO_MODE_FILE 2
00399 
00400 static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mimetype_emu) /* {{{ */
00401 {
00402        long options = 0;
00403        char *ret_val = NULL, *buffer = NULL;
00404        int buffer_len;
00405        struct php_fileinfo *finfo = NULL;
00406        zval *zfinfo, *zcontext = NULL;
00407        zval *what;
00408        char mime_directory[] = "directory";
00409 
00410        struct magic_set *magic = NULL;
00411        FILEINFO_DECLARE_INIT_OBJECT(object)
00412 
00413        if (mimetype_emu) {
00414 
00415               /* mime_content_type(..) emulation */
00416               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &what) == FAILURE) {
00417                      return;
00418               }
00419 
00420               switch (Z_TYPE_P(what)) {
00421                      case IS_STRING:
00422                             buffer = Z_STRVAL_P(what);
00423                             buffer_len = Z_STRLEN_P(what);
00424                             mode = FILEINFO_MODE_FILE;
00425                             break;
00426 
00427                      case IS_RESOURCE:
00428                             mode = FILEINFO_MODE_STREAM;
00429                             break;
00430 
00431                      default:
00432                             php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only process string or stream arguments");
00433                             RETURN_FALSE;
00434               }
00435 
00436               magic = magic_open(MAGIC_MIME_TYPE);
00437               if (magic_load(magic, NULL) == -1) {
00438                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to load magic database.");
00439                      goto common;
00440               }
00441        } else if (object) {
00442               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lr", &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
00443                      RETURN_FALSE;
00444               }
00445               FILEINFO_FROM_OBJECT(finfo, object);
00446               magic = finfo->magic;
00447        } else {
00448               if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|lr", &zfinfo, &buffer, &buffer_len, &options, &zcontext) == FAILURE) {
00449                      RETURN_FALSE;
00450               }
00451               ZEND_FETCH_RESOURCE(finfo, struct php_fileinfo *, &zfinfo, -1, "file_info", le_fileinfo);
00452               magic = finfo->magic;
00453        }      
00454 
00455        /* Set options for the current file/buffer. */
00456        if (options) {
00457               FINFO_SET_OPTION(magic, options)
00458        }
00459 
00460        switch (mode) {
00461               case FILEINFO_MODE_BUFFER:
00462               {
00463                      ret_val = (char *) magic_buffer(magic, buffer, buffer_len);
00464                      break;
00465               }
00466 
00467               case FILEINFO_MODE_STREAM:
00468               {
00469                             php_stream *stream;
00470                             off_t streampos;
00471 
00472                             php_stream_from_zval_no_verify(stream, &what);
00473                             if (!stream) {
00474                                    goto common;
00475                             }
00476 
00477                             streampos = php_stream_tell(stream); /* remember stream position for restoration */
00478                             php_stream_seek(stream, 0, SEEK_SET);
00479 
00480                             ret_val = (char *) magic_stream(magic, stream);
00481 
00482                             php_stream_seek(stream, streampos, SEEK_SET);
00483                             break;
00484               }
00485 
00486               case FILEINFO_MODE_FILE:
00487               {
00488                      /* determine if the file is a local file or remote URL */
00489                      char *tmp2;
00490                      php_stream_wrapper *wrap;
00491                      php_stream_statbuf ssb;
00492 
00493                      if (buffer == NULL || !*buffer) {
00494                             php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty filename or path");
00495                             RETVAL_FALSE;
00496                             goto clean;
00497                      }
00498 
00499                      wrap = php_stream_locate_url_wrapper(buffer, &tmp2, 0 TSRMLS_CC);
00500 
00501                      if (wrap) {
00502                             php_stream_context *context = php_stream_context_from_zval(zcontext, 0);
00503 #if PHP_API_VERSION < 20100412
00504                             php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL, context);
00505 #else
00506                             php_stream *stream = php_stream_open_wrapper_ex(buffer, "rb", REPORT_ERRORS, NULL, context);
00507 #endif
00508 
00509                             if (!stream) {
00510                                    RETVAL_FALSE;
00511                                    goto clean;
00512                             }
00513 
00514                             if (php_stream_stat(stream, &ssb) == SUCCESS) {
00515                                    if (ssb.sb.st_mode & S_IFDIR) {
00516                                           ret_val = mime_directory;
00517                                    } else {
00518                                           ret_val = (char *)magic_stream(magic, stream);
00519                                    }
00520                             }
00521 
00522                             php_stream_close(stream);
00523                      }
00524                      break;
00525               }
00526 
00527               default:
00528                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only process string or stream arguments");
00529        }
00530 
00531 common:
00532        if (ret_val) {
00533               RETVAL_STRING(ret_val, 1);
00534        } else {
00535               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed identify data %d:%s", magic_errno(magic), magic_error(magic));
00536               RETVAL_FALSE;
00537        }
00538 
00539 clean:
00540        if (mimetype_emu) {
00541               magic_close(magic);
00542        }
00543 
00544        /* Restore options */
00545        if (options) {
00546               FINFO_SET_OPTION(magic, finfo->options)
00547        }
00548        return;
00549 }
00550 /* }}} */
00551 
00552 /* {{{ proto string finfo_file(resource finfo, char *file_name [, int options [, resource context]])
00553    Return information about a file. */
00554 PHP_FUNCTION(finfo_file)
00555 {
00556        _php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, FILEINFO_MODE_FILE, 0);
00557 }
00558 /* }}} */
00559 
00560 /* {{{ proto string finfo_buffer(resource finfo, char *string [, int options [, resource context]])
00561    Return infromation about a string buffer. */
00562 PHP_FUNCTION(finfo_buffer)
00563 {
00564        _php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, FILEINFO_MODE_BUFFER, 0);
00565 }
00566 /* }}} */
00567 
00568 /* {{{ proto string mime_content_type(string filename|resource stream)
00569    Return content-type for file */
00570 PHP_FUNCTION(mime_content_type)
00571 {
00572        _php_finfo_get_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, -1, 1);
00573 }
00574 /* }}} */
00575 
00576 
00577 /*
00578  * Local variables:
00579  * tab-width: 4
00580  * c-basic-offset: 4
00581  * End:
00582  * vim600: noet sw=4 ts=4 fdm=marker
00583  * vim<600: noet sw=4 ts=4
00584  */