Update CodeIgniter system 3.1.0 => 3.1.16

This commit is contained in:
2020-08-02 02:23:47 -04:00
parent 3523bc5f57
commit 083b534f0a
176 changed files with 2351 additions and 1889 deletions
+31 -19
View File
@@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,8 +29,8 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@@ -678,10 +678,8 @@ class CI_Upload {
$this->set_error('upload_bad_filename', 'debug');
return FALSE;
}
else
{
return $new_filename;
}
return $new_filename;
}
// --------------------------------------------------------------------
@@ -1083,16 +1081,27 @@ class CI_Upload {
return FALSE;
}
if (memory_get_usage() && ($memory_limit = ini_get('memory_limit')))
if (memory_get_usage() && ($memory_limit = ini_get('memory_limit')) > 0)
{
$memory_limit *= 1024 * 1024;
// There was a bug/behavioural change in PHP 5.2, where numbers over one million get output
// into scientific notation. number_format() ensures this number is an integer
// http://bugs.php.net/bug.php?id=43053
$memory_limit = number_format(ceil(filesize($file) + $memory_limit), 0, '.', '');
$memory_limit = str_split($memory_limit, strspn($memory_limit, '1234567890'));
if ( ! empty($memory_limit[1]))
{
switch ($memory_limit[1][0])
{
case 'g':
case 'G':
$memory_limit[0] *= 1024 * 1024 * 1024;
break;
case 'm':
case 'M':
$memory_limit[0] *= 1024 * 1024;
break;
default:
break;
}
}
$memory_limit = (int) ceil(filesize($file) + $memory_limit[0]);
ini_set('memory_limit', $memory_limit); // When an integer is used, the value is measured in bytes. - PHP.net
}
@@ -1207,10 +1216,13 @@ class CI_Upload {
// We'll need this to validate the MIME info string (e.g. text/plain; charset=us-ascii)
$regexp = '/^([a-z\-]+\/[a-z0-9\-\.\+]+)(;\s.+)?$/';
/* Fileinfo extension - most reliable method
/**
* Fileinfo extension - most reliable method
*
* Unfortunately, prior to PHP 5.3 - it's only available as a PECL extension and the
* more convenient FILEINFO_MIME_TYPE flag doesn't exist.
* Apparently XAMPP, CentOS, cPanel and who knows what
* other PHP distribution channels EXPLICITLY DISABLE
* ext/fileinfo, which is otherwise enabled by default
* since PHP 5.3 ...
*/
if (function_exists('finfo_file'))
{
@@ -1298,7 +1310,7 @@ class CI_Upload {
}
}
// Fall back to the deprecated mime_content_type(), if available (still better than $_FILES[$field]['type'])
// Fall back to mime_content_type(), if available (still better than $_FILES[$field]['type'])
if (function_exists('mime_content_type'))
{
$this->file_type = @mime_content_type($file['tmp_name']);