Welcome Guest, Not a member yet? Register   Sign In
Override core/input CI3
#1
Exclamation 

Hello folks,

All was well until I tried to upgrade to CI 3. This is the error I am getting, and don't really know why? Angry

Code:
A PHP Error was encountered

  Severity: 4096

  Message: Argument 1 passed to get_config() must be of the type array, string  
  given, called in  
  XAMPP/xamppfiles/htdocs/test/application/core/MY_Input.php on  
  line 6 and defined

  Filename: core/Common.php

  Line Number: 238

This is all I have on MY_Input.php

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

       Class MY_Input extends CI_Input
    {

       function _clean_input_keys($str)
     {
    $config = &get_config('config');  **//  LINE 6**

    if ( ! preg_match("/^[".$config['permitted_uri_chars']."]+$/i",

    rawurlencode($str)))

     {
        exit('Disallowed Key Characters.');
     }

    // Clean UTF-8 if supported
    if (UTF8_ENABLED === TRUE)
    {
        $str = $this->uni->clean_string($str);
    }

    return $str;
    }

    }

This is a system file:
Filename: core/Common.php
Line Number: 238

Code:
function &get_config(Array $replace = array())  **// LINE 238**
    {
    static $config;

    if (empty($config))
    {
        $file_path = APPPATH.'config/config.php';
        $found = FALSE;
        if (file_exists($file_path))
        {
            $found = TRUE;
            require($file_path);
        }

        // Is the config file in the environment folder?
        if (file_exists($file_path =
         APPPATH.'config/'.ENVIRONMENT.'/config.php'))
        {
            require($file_path);
        }
        elseif ( ! $found)
        {
            set_status_header(503);
            echo 'The configuration file does not exist.';
            exit(3); // EXIT_CONFIG
        }

        // Does the $config array exist in the file?
        if ( ! isset($config) OR ! is_array($config))
        {
            set_status_header(503);
            echo 'Your config file does not appear to be formatted  
             correctly.';
            exit(3); // EXIT_CONFIG
        }
    }

    foreach ($replace as $key => $val)
    {
        $config[$key] = $val;
    }

    return $config;
    }

Why is it telling me it's not an array since it worked perfectly with previous versions?

Thank you :
Reply


Messages In This Thread
[2.2.1 to 3] Argument 1 passed to get_config() must be of the type array - by rocks - 02-15-2015, 11:29 PM
Override core/input CI3 - by rocks - 02-16-2015, 12:27 AM
RE: Override core/input CI3 - by Narf - 02-16-2015, 01:54 AM
RE: Override core/input CI3 - by rocks - 02-16-2015, 10:29 AM
RE: Override core/input CI3 - by mwhitney - 02-16-2015, 11:17 AM
RE: Override core/input CI3 - by rocks - 02-16-2015, 03:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB