Welcome Guest, Not a member yet? Register   Sign In
"Unable to locate the specified class: Session.php"...
#1

Hi Guys,

After some years developing with CI i'm here to write about an issue i experiencing with v3.1.4

Starting with my code:

application/core
PHP Code:
class FF_Controller extends CI_Controller
{
 
   
    public 
function LoadView($view$data null)
 
   {
 
       $head_data = array();
 
       if(array_key_exists("title"$data)){
 
           $head_data["title"] = $data["title"];
 
       }

 
       $this->load->view("layout/_header"$head_data);
 
       $this->load->view("layout/_nav");
 
       $this->load->view($view$data);
 
       $this->load->view("layout/_footer");
 
   }


PHP Code:
abstract class FF_Model extends CI_Model
{
 
  public function getDbInstance($show_errors true) {
 
       $this->load->database();

 
       //Nasconde la pagina d'errore di MySQL che mi fa fallire Ajax
 
       $this->db->db_debug $show_errors;

 
       return $this->db;
 
   }

 
   public abstract function mapFromDb($result);
 
   public abstract function mapToDb($result);



application/controllers
PHP Code:
class Login extends FF_Controller
{
 
   public function index()
 
   {
 
       $this->LoadView("login/index");
 
   }

 
   public function dologin()
 
   {
 
       $user $this->input->post('username');
 
       $pwd $this->input->post('password');

 
       $this->load->model("user_model");
 
       $usr $this->user_model->get($user$pwd);

 
       $this->session->set_userdata(array('user' => $usr));
 
       redirect(base_url());
 
   }



application/config/autoload.php
PHP Code:
<?php
$autoload
['packages'] = array();
$autoload['libraries'] = array('session');
$autoload['drivers'] = array();
$autoload['helper'] = array('url');
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array(); 

application/models
PHP Code:
class User_model extends FF_Model
{
 
   public function get($mail$pwd)
 
   {
 
       $db $this->getDbInstance();
 
       
        
//Login data retriving with pwd encoding: all written inline with querybuilder

 
       $res $this->mapFromDb($db->get()->result());
 
       if(count($res) == 1) return $res[0];
 
       else return false;
 
   }




Removing the autoload "session" entry all working.

Looking in System/libraries seems that session.php does not exists. Nevertheless, that file seems to be in the Session subdirectory (system/libraries/session/). But load_class(...) is not looking inside that folder:

PHP Code:
// Look for the class first in the local application/libraries folder
        // then in the native system/libraries folder
        
foreach (array(APPPATHBASEPATH) as $path)
        {
            if (
file_exists($path.$directory.'/'.$class.'.php'))
            {
                
$name 'CI_'.$class;

                if (
class_exists($nameFALSE) === FALSE)
                {
                    require_once(
$path.$directory.'/'.$class.'.php');
                }

                break;
            }
        } 


How can i set to work properly my session library?
PS: loading it manually from the controller method does not change the result. I still get the error. Logs are pretty clean. Only debug infos not related to sessions.
Reply


Messages In This Thread
"Unable to locate the specified class: Session.php"... - by sslazio 1900 - 06-13-2017, 07:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB