Welcome Guest, Not a member yet? Register   Sign In
php 5.3 errors
#1

[eluser]Moddi[/eluser]
one.com release php 5.3 last night i got these errors now.

Undefined property: CI_Loader::$session

and

Fatal error: Call to a member function userdata() on a non-object in

visit www.dack4.se to see the errors alive.

On line 126:

Code:
<?php
        $mess = $this->session->userdata('mess');
        if(!empty($mess))
        {
        ?>

Anyone know how i can fix it?

Codeigniter version: 1.7.2

well what more do u wanna know so that i can add it?
#2

[eluser]danmontgomery[/eluser]
Can you confirm that the session library is being loaded?
#3

[eluser]Moddi[/eluser]
$autoload['libraries'] = array('database','session');

Its autoloaded
#4

[eluser]Sbioko[/eluser]
Because you use CI in view. Maybe, you didn't send CI's object to view correctly. I need to see your views/header.php file.
#5

[eluser]Moddi[/eluser]
Heres the header file, i attached it.
#6

[eluser]Sbioko[/eluser]
As I thought. And, I also need the code of your controller and I'll definitely help you. I think it is not about PHP 5.3.
#7

[eluser]Moddi[/eluser]
Im going to mail it to you, attaching the file there.
#8

[eluser]Sbioko[/eluser]
Ok.
#9

[eluser]John_Betong[/eluser]
[quote author="Moddi" date="1266356989"]one.com release php 5.3 last night i got these errors now.

Undefined property: CI_Loader::$session

and

Fatal error: Call to a member function userdata() on a non-object in

visit www.dack4.se to see the errors alive.

On line 126:

Code:
<?php
        $mess = $this->session->userdata('mess');
        if(!empty($mess))
        {
        ?>

Anyone know how i can fix it?

Codeigniter version: 1.7.2

well what more do u wanna know so that i can add it?[/quote]


Try this:
Code:
$mess = isset($this->session->userdata('mess')) ? $this->session->userdata('mess') : '';

if(!empty($mess))
{
  // has value
}else{
  // empty???
}
 
*nbsp;
#10

[eluser]Moddi[/eluser]
[quote author="John_Betong" date="1266394615"][quote author="Moddi" date="1266356989"]one.com release php 5.3 last night i got these errors now.

Undefined property: CI_Loader::$session

and

Fatal error: Call to a member function userdata() on a non-object in

visit www.dack4.se to see the errors alive.

On line 126:

Code:
<?php
        $mess = $this->session->userdata('mess');
        if(!empty($mess))
        {
        ?>

Anyone know how i can fix it?

Codeigniter version: 1.7.2

well what more do u wanna know so that i can add it?[/quote]


Try this:
Code:
$mess = isset($this->session->userdata('mess')) ? $this->session->userdata('mess') : '';

if(!empty($mess))
{
  // has value
}else{
  // empty???
}
 
*nbsp;[/quote]

I got this error when i tried what u said

Fatal error: Can't use method return value in write context in




Theme © iAndrew 2016 - Forum software by © MyBB