summaryrefslogtreecommitdiffstats
path: root/system/core/CodeIgniter.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-02 21:44:29 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-02 21:44:29 +0100
commit533bf2dd5f36e277a9ee6629ccd667a32b05d154 (patch)
treee9dac47a000fb8cafd5b3c801b129e3043330577 /system/core/CodeIgniter.php
parent8a203f65dd265d7b1d25ad143cb86db813c47824 (diff)
Fix a directory/404_override bug and some routing-related optimizations
Diffstat (limited to 'system/core/CodeIgniter.php')
-rw-r--r--system/core/CodeIgniter.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 633be7fab..12747c5d9 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -267,9 +267,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
{
if ( ! empty($RTR->routes['404_override']))
{
- $x = explode('/', $RTR->routes['404_override'], 2);
- $class = $x[0];
- $method = isset($x[1]) ? $x[1] : 'index';
+ if (sscanf($RTR->routes['404_override'], '%[^/]/%s', $class, $method) !== 2)
+ {
+ $method = 'index';
+ }
+
if ( ! class_exists($class))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
@@ -327,9 +329,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
// Check and see if we are using a 404 override and use it.
if ( ! empty($RTR->routes['404_override']))
{
- $x = explode('/', $RTR->routes['404_override'], 2);
- $class = $x[0];
- $method = isset($x[1]) ? $x[1] : 'index';
+ if (sscanf($RTR->routes['404_override'], '%[^/]/%s', $class, $method) !== 2)
+ {
+ $method = 'index';
+ }
+
if ( ! class_exists($class))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))