PHP warning

finfo_file(): Null byte in regex

/mnt/data/shnoulle/nginx/www/master/framework/utils/CFileHelper.php(282)

270      * PHP extension is available. This parameter has been available since version 1.1.3.
271      * @param boolean $checkExtension whether to check the file extension in case the MIME type cannot be determined
272      * based on finfo and mime_content_type. Defaults to true. This parameter has been available since version 1.1.4.
273      * @return string the MIME type. Null is returned if the MIME type cannot be determined.
274      */
275     public static function getMimeType($file,$magicFile=null,$checkExtension=true)
276     {
277         if(function_exists('finfo_open'))
278         {
279             $options=defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
280             $info=$magicFile===null ? finfo_open($options) : finfo_open($options,$magicFile);
281 
282             if($info && ($result=finfo_file($info,$file))!==false)
283                 return $result;
284         }
285 
286         if(function_exists('mime_content_type') && ($result=mime_content_type($file))!==false)
287             return $result;
288 
289         return $checkExtension ? self::getMimeTypeByExtension($file) : null;
290     }
291 
292     /**
293      * Determines the MIME type based on the extension name of the specified file.
294      * This method will use a local map between extension name and MIME type.

Stack Trace

#1
+
 /mnt/data/shnoulle/nginx/www/master/application/core/LSFileHelper.php(71): CFileHelper::getMimeType("/tmp/phpzmYYCX", "/usr/share/misc/magic.mgc", true)
66             return $mimeType;
67         }
68         if(empty($magicFile) && Yii::app()->getConfig('magic_database')) {
69             $magicFile = Yii::app()->getConfig('magic_database');
70         }
71         return parent::getMimeType($file,$magicFile,$checkExtension);
72     }
73 }
#2
+
 /mnt/data/shnoulle/nginx/www/master/application/core/LSFileHelper.php(43): LSFileHelper::getMimeType("/tmp/phpzmYYCX")
38             $mimeTypes=require(Yii::getPathOfAlias('system.utils.fileExtensions').'.php');
39         }
40         elseif($magicFile!==null && !isset($customMimeTypes[$magicFile])) {
41             $customMimeTypes[$magicFile]=require($magicFile);
42         }
43         $mime = self::getMimeType($file);
44         if($mime !== null) {
45             $mime=strtolower($mime);
46             if($magicFile===null && isset($mimeTypes[$mime])) {
47                 return $mimeTypes[$mime];
48             } elseif($magicFile!==null && isset($customMimeTypes[$magicFile][$mime])) {
#3
+
 /mnt/data/shnoulle/nginx/www/master/application/controllers/UploaderController.php(180): LSFileHelper::getExtensionByMimeType("/tmp/phpzmYYCX", "/mnt/data/shnoulle/nginx/www/master/upload/fileExtensionsBis.php")
175                 //header('Content-Type: application/json');
176                 echo ls_json_encode($return);
177                 Yii::app()->end();
178             }
179             /* extension checked : check mimeType */
180             $extByMimeType = LSFileHelper::getExtensionByMimeType($_FILES['uploadfile']['tmp_name'], null);
181             $disableCheck = false;
182             if(is_null($extByMimeType)) {
183                 /* Lack of finfo_open or mime_content_type ? But can be a not found extension too.*/
184                 /* Check if can find mime type of favicon.ico , without extension */
185                 /* Use CFileHelper because sure it work with included */
2019-11-14 17:30:12 nginx/1.16.1 Yii Framework/1.1.21