Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

is_callable() was fixed in PHP 5_0; remove workaround

The bug with is_callable() and private methods was fixed
some time in PHP 5.0.  We require 5.2.4, so we can switch
back to is_callable().

<http://uk.php.net/manual/en/function.is-callable.php>
<https://bugs.php.net/bug.php?id=29210>
  • Loading branch information...
commit d2de251c092d9d822fc4898e3681b64e9c74dd2a 1 parent 3320b66
@sourcejedi authored
Showing with 3 additions and 4 deletions.
  1. +3 −4 system/core/CodeIgniter.php
View
7 system/core/CodeIgniter.php
@@ -273,7 +273,7 @@ function &get_instance()
if ( ! class_exists($class)
OR strpos($method, '_') === 0
- OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
+ OR is_callable(array('CI_Controller', $method))
)
{
if ( ! empty($RTR->routes['404_override']))
@@ -333,9 +333,8 @@ function &get_instance()
}
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))))
+ // Check the method is callable.
+ if ( ! is_callable($CI, $method))
{
// Check and see if we are using a 404 override and use it.
if ( ! empty($RTR->routes['404_override']))
Please sign in to comment.
Something went wrong with that request. Please try again.