summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-11-02 03:37:34 +0100
committerAndrey Andreev <narf@bofh.bg>2012-11-02 03:37:34 +0100
commit7d394f8cc75dff27324279bfbaffb1a487ea6dc7 (patch)
tree465c765926842e04b0e4b67e39390108f87e203a
parenta24e52e1c0136db0c1949e73255b4e9bf114b437 (diff)
Router-related optimizations
An improved version of changes suggesed in PR #1352, and more specifically: https://github.com/sourcejedi/CodeIgniter/commit/8f7d2dfe42bd8543981c0f295e391e433d82fd42 https://github.com/sourcejedi/CodeIgniter/commit/d2de251c092d9d822fc4898e3681b64e9c74dd2a (thanks again @sourcejedi)
-rw-r--r--system/core/CodeIgniter.php13
-rw-r--r--system/core/Router.php7
2 files changed, 4 insertions, 16 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index ee1e9b9c9..633be7fab 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -256,17 +256,14 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* Security check
* ------------------------------------------------------
*
- * None of the functions in the app controller or the
+ * None of the methods in the app controller or the
* loader class can be called via the URI, nor can
- * controller functions that begin with an underscore
+ * controller functions that begin with an underscore.
*/
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();
- if ( ! class_exists($class)
- OR strpos($method, '_') === 0
- OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
- )
+ if ( ! class_exists($class) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
{
if ( ! empty($RTR->routes['404_override']))
{
@@ -325,9 +322,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
}
else
{
- // is_callable() returns TRUE on some versions of PHP 5 for private and protected
- // methods, so we'll use this workaround for consistent behavior
- if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI))))
+ if ( ! is_callable(array($CI, $method)))
{
// Check and see if we are using a 404 override and use it.
if ( ! empty($RTR->routes['404_override']))
diff --git a/system/core/Router.php b/system/core/Router.php
index 89fb74f2f..48c157f18 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -54,13 +54,6 @@ class CI_Router {
public $routes = array();
/**
- * List of error routes
- *
- * @var array
- */
- public $error_routes = array();
-
- /**
* Current class name
*
* @var string