mumin aydin
mumin aydin

Reputation: 63

codeigniter fatal error Call to a member function cookie() on a non-object

i have Codeigniter v202, and php version 5.2.17 my site works just good in my local but in the server i keep getting this error message in everypage, message in error log is:

PHP Fatal error: Call to a member function cookie() on a non-object in /path/to/libraries/Session.php on line 138

and in page i have

A PHP Error was encountered

Severity: Notice

Message: Undefined property: MY_CONTROLLER_NAME::$input

Filename: libraries/Session.php

Line Number: 138

this is line 138:

$session = $this->CI->input->cookie($this->sess_cookie_name);

library is the original, i didnt make any changes on it. please help!

Upvotes: 1

Views: 2266

Answers (1)

mumin aydin
mumin aydin

Reputation: 63

I found what was wrong. i had

setlocale(LC_ALL, 'tr_TR');

in my /index.php. so weird but session library did not initialize core input. it took me long to find but when i echo

echo var_dump($this->CI);

there was ? (question mark) instead of the char I then it was ?nput. my locale didn't capitalize char i as I, that was the problem. weird thing is it worked in localhost but didn't work on the server.

Upvotes: 2

Related Questions