summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-02-09 22:35:08 +0100
committerAndrey Andreev <narf@devilix.net>2016-02-09 22:35:08 +0100
commit477e08f1d6726809660e4841f389493541f7bc07 (patch)
tree785b12b53c5e46e317def1768558f33445ab2b1f /system/libraries
parent2342256c076502cbaca86fcff2a1dbbfc49a1900 (diff)
parent39967987ebcc79fc867c1f7fa8d69cc65801f594 (diff)
Merge branch '3.0-stable' into develop
Fixed conflicts: user_guide_src/source/overview/at_a_glance.rst
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Form_validation.php8
-rw-r--r--system/libraries/Upload.php6
2 files changed, 14 insertions, 0 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 31632762d..ea3bc6de7 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1214,6 +1214,14 @@ class CI_Form_validation {
$str = $matches[2];
}
+ // PHP 7 accepts IPv6 addresses within square brackets as hostnames,
+ // but it appears that the PR that came in with https://bugs.php.net/bug.php?id=68039
+ // was never merged into a PHP 5 branch ... https://3v4l.org/8PsSN
+ if (preg_match('/^\[([^\]]+)\]/', $str, $matches) && ! is_php('7') && filter_var($matches[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== FALSE)
+ {
+ $str = 'ipv6.host'.substr($str, strlen($matches[1]) + 2);
+ }
+
$str = 'http://'.$str;
// There's a bug affecting PHP 5.2.13, 5.3.2 that considers the
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 15caebebe..f2418378b 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -526,6 +526,12 @@ class CI_Upload {
$this->file_name = preg_replace('/\s+/', '_', $this->file_name);
}
+ if ($this->file_ext_tolower && ($ext_length = strlen($this->file_ext)))
+ {
+ // file_ext was previously lower-cased by a get_extension() call
+ $this->file_name = substr($this->file_name, 0, -$ext_length).$this->file_ext;
+ }
+
/*
* Validate the file name
* This function appends an number onto the end of