summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-01-15 17:37:01 +0100
committerAndrey Andreev <narf@devilix.net>2014-01-15 17:37:01 +0100
commit08fef7de41cb06785cdb1024769892d9510e6e6b (patch)
treea261799206ceb67124896c11b4b61b13eb726a83 /system
parentd8b1ad31cf7ee205ddf3cf396b1d1bfa45af49fa (diff)
Fix #2799 by adding conditional PCRE UTF-8 support to CI_URI::filter_uri()
Also did a tiny micro-optimization in the Utf8 class.
Diffstat (limited to 'system')
-rw-r--r--system/core/URI.php2
-rw-r--r--system/core/Utf8.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/system/core/URI.php b/system/core/URI.php
index 3d6d202c0..c83b7a74f 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -320,7 +320,7 @@ class CI_URI {
*/
public function filter_uri($str)
{
- if ( ! empty($str) && ! empty($this->_permitted_uri_chars) && ! preg_match('/^['.$this->_permitted_uri_chars.']+$/i', $str))
+ if ( ! empty($str) && ! empty($this->_permitted_uri_chars) && ! preg_match('/^['.$this->_permitted_uri_chars.']+$/i'.(UTF8_ENABLED ? 'u' : ''), $str))
{
show_error('The URI you submitted has disallowed characters.', 400);
}
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index a78616d40..828a8aeba 100644
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
@@ -66,7 +66,7 @@ class CI_Utf8 {
}
if (
- @preg_match('/./u', 'é') === 1 // PCRE must support UTF-8
+ defined('PREG_BAD_UTF8_ERROR') // PCRE must support UTF-8
&& function_exists('iconv') // iconv must be installed
&& MB_ENABLED === TRUE // mbstring must be enabled
&& $charset === 'UTF-8' // Application charset must be UTF-8