summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Upload.php23
-rw-r--r--tests/codeigniter/libraries/Encrypt_test.php6
-rw-r--r--tests/codeigniter/libraries/Encryption_test.php10
-rw-r--r--user_guide_src/source/changelog.rst4
4 files changed, 38 insertions, 5 deletions
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index a8cf75264..23fd02ead 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -1083,10 +1083,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;
- $memory_limit = (int) ceil(filesize($file) + $memory_limit);
+ $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
}
diff --git a/tests/codeigniter/libraries/Encrypt_test.php b/tests/codeigniter/libraries/Encrypt_test.php
index ced763301..adbca31b2 100644
--- a/tests/codeigniter/libraries/Encrypt_test.php
+++ b/tests/codeigniter/libraries/Encrypt_test.php
@@ -10,6 +10,10 @@ class Encrypt_test extends CI_TestCase {
{
return;
}
+ elseif (version_compare(PHP_VERSION, '7.1.0-alpha', '>='))
+ {
+ return $this->markTestSkipped('ext/mcrypt is deprecated since PHP 7.1 and will generate notices here.');
+ }
$this->encrypt = new Mock_Libraries_Encrypt();
$this->ci_instance_var('encrypt', $this->encrypt);
@@ -72,4 +76,4 @@ class Encrypt_test extends CI_TestCase {
$this->assertEquals('cfb', $this->encrypt->get_mode());
}
-} \ No newline at end of file
+}
diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php
index cbcae3133..96e52ada8 100644
--- a/tests/codeigniter/libraries/Encryption_test.php
+++ b/tests/codeigniter/libraries/Encryption_test.php
@@ -240,6 +240,10 @@ class Encryption_test extends CI_TestCase {
{
return $this->markTestSkipped('Cannot test MCrypt because it is not available.');
}
+ elseif (version_compare(PHP_VERSION, '7.1.0-alpha', '>='))
+ {
+ return $this->markTestSkipped('ext/mcrypt is deprecated since PHP 7.1 and will generate notices here.');
+ }
$this->assertTrue(is_resource($this->encryption->__driver_get_handle('mcrypt', 'rijndael-128', 'cbc')));
}
@@ -274,6 +278,10 @@ class Encryption_test extends CI_TestCase {
$this->markTestSkipped('Both MCrypt and OpenSSL support are required for portability tests.');
return;
}
+ elseif (version_compare(PHP_VERSION, '7.1.0-alpha', '>='))
+ {
+ return $this->markTestSkipped('ext/mcrypt is deprecated since PHP 7.1 and will generate notices here.');
+ }
$message = 'This is a message encrypted via MCrypt and decrypted via OpenSSL, or vice-versa.';
@@ -377,4 +385,4 @@ class Encryption_test extends CI_TestCase {
$this->assertEquals('stream', $this->encryption->mode);
}
-} \ No newline at end of file
+}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 26587ad3e..35dc76476 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -43,7 +43,9 @@ Version 3.1.1
Release Date: Not Released
+- General Changes
+ - Added ``E_PARSE`` to the list of error levels detected by the shutdown handler.
Bug fixes for 3.1.1
-------------------
@@ -54,6 +56,8 @@ Bug fixes for 3.1.1
- Fixed a regression (#4739) - :doc:`Email Library <libraries/email>` doesn't properly separate attachment bodies from headers.
- Fixed a bug (#4754) - :doc:`Unit Testing Library <libraries/unit_testing>` method ``result()`` didn't translate ``res_datatype``.
- Fixed a bug (#4759) - :doc:`Form Validation <libraries/form_validation>`, :doc:`Trackback <libraries/trackback>` and `XML-RPC <libraries/xmlrpc>` libraries treated URI schemes in a case-sensitive manner.
+- Fixed a bug (#4762) - :doc:`Cache Library <libraries/caching>` 'file' driver method ``get_metadata()`` checked TTL time against ``mtime`` instead of the cache item's creation time.
+- Fixed a bug where :doc:`File Uploading Library <libraries/file_uploading>` generated error messages on PHP 7.1.
Version 3.1.0
=============