Welcome Guest, Not a member yet? Register   Sign In
Call to undefined function get_instance()
#1

[eluser]Majd Taby[/eluser]
Hey, when I have xss filtering turned on in the config.php file, i get the following error:


Fatal error: Call to undefined function get_instance() in /Users/majd/Sites/cap1_wc/trunk/system/libraries/Input.php on line 855

As soon as i turn it off, the whole thing works perfect
#2

[eluser]Antivanity[/eluser]
I ran into the same issue. The method in question is:

Code:
function _html_entity_decode_callback($match)
    {
        $CI =& get_instance(); // This is the line it errors on.
        $charset = $CI->config->item('charset');

        return $this->_html_entity_decode($match[0], strtoupper($charset));
    }

Quote:PHP Fatal error: Call to undefined function get_instance() in .../system/libraries/Input.php on line 855

I get this error when the user inputs '<stuff>'. But '<>' or the '<' and '>' char's alone will not mess it up.

Any thoughs guys ?
#3

[eluser]Antivanity[/eluser]
After some more searching i found a post on this issue:

http://ellislab.com/forums/viewthread/60481/

Antivanity
#4

[eluser]nmweb[/eluser]
The solution is indeed as mentioned in the other thread:
Code:
function _html_entity_decode_callback($match)
    {
        $charset = config_item('charset');

        return $this->_html_entity_decode($match[0], strtoupper($charset));
    }
The error is however caused because in codeigniter.php the Base4/5.php file is only loaded after the Input-class. In the Base4/5.php file the get_instance() function is written and it is conditionally loaded so it won't be present until after it is loaded. Therefore the function is not present, yet. Another fix would probably be moving the IN=& load_class('Input'); after the loading of the base4/5.php file. I haven't checked though. Neither would I really know the benefits of either solution.
#5

[eluser]Antivanity[/eluser]
Thank you for explaining the reason behind this error.




Theme © iAndrew 2016 - Forum software by © MyBB