CodeIgniter Forums
Weird autoload bug - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Weird autoload bug (/thread-35990.html)

Pages: 1 2


Weird autoload bug - El Forum - 11-17-2010

[eluser]georgeedwards[/eluser]
Hello all. I've had a production site live for a few months now (ftw.gd) but today just randomly discovered an error. I think it may be due to a hosting PHP upgrade, but they say they haven't upgraded anything. Not a great help.

But anyway, it seems as though, I can't autoload Session properly anymore. In fact, I can't load the library anywhere.

My autoload is:
Code:
$autoload['libraries'] = array('database', 'session');

This produces:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$session

Filename: views/header.php

Line Number: 43

The funny thing is, if I take out autoloading of the database library, the Session library loads successfully and works fine.

What gives? Any ideas?


Weird autoload bug - El Forum - 11-17-2010

[eluser]Learn CodeIgniter[/eluser]
And what is on line 43 in header.php


Weird autoload bug - El Forum - 11-17-2010

[eluser]georgeedwards[/eluser]
Err,

Code:
<?php if ($this->session->flashdata('flash')): ?>

Just a simple check for flash data.

But this is kinda irrelevant, like I say, it's worked without interruption for months then all of a sudden - boom.


Weird autoload bug - El Forum - 11-17-2010

[eluser]georgeedwards[/eluser]
Also, I can confirm that Session is being loaded. If I put on the line above:

Code:
<?php $this->load->library('session'); ?>

... this loads without error. But calling any session member function just errors. Or, if I var_dump the Session class, I don't get anything back.

Very weird Sad


Weird autoload bug - El Forum - 11-17-2010

[eluser]Learn CodeIgniter[/eluser]
What version of CI are you using?


Weird autoload bug - El Forum - 11-17-2010

[eluser]georgeedwards[/eluser]
1.7.2. Thanks for your help.

I am very, very confused.


Weird autoload bug - El Forum - 11-17-2010

[eluser]Learn CodeIgniter[/eluser]
You could have some corrupted files, this happened to me once before.

Try re-downloading Codigniter and re-install it.


Weird autoload bug - El Forum - 11-18-2010

[eluser]georgeedwards[/eluser]
[quote author="Learn CodeIgniter" date="1290076166"]You could have some corrupted files, this happened to me once before.

Try re-downloading Codigniter and re-install it.[/quote]

Thanks. But already tried that. I also replaced the production copy of the code with my development copy, and still - the same error.

It's very very weird. I am beginning to think it must be a server problem...

Any more suggestions on where to look?

Cheers


Weird autoload bug - El Forum - 11-23-2010

[eluser]georgeedwards[/eluser]
Gotcha! It was a hosting issue. My host had disabled mysql_pconnect, but it was not throwing these errors.

Enabled debug logging, and noticed it Smile

Thanks, hope this can help someone else in the future?


Weird autoload bug - El Forum - 11-23-2010

[eluser]Narkboy[/eluser]
Nice host to tell you they haven't changed the hosting when they have.. Sad