Welcome Guest, Not a member yet? Register   Sign In
Database config loading too early
#1

[eluser]CrazyMerlin[/eluser]
Hey guys!

I decided to autoload some features as I know I would need them throughout and encountered this error when autoloading the database library:

Code:
Message: Undefined variable: config

Filename: config/database.php

Line Number: 49

It seems that the config/database.php file is being loaded before the config/config.php file...which makes no sense, or the $config array is somehow being overwritten.

Any ideas?

//erlin!
#2

[eluser]TheFuzzy0ne[/eluser]
It sounds to me like you might be loading the database file manually as a config file. Check for any calls to $this->load->config('database');
#3

[eluser]CrazyMerlin[/eluser]
Nope, just ran a find on that string and it doesn't appear at all in the entire project.
Why use a global array anyway, why not the config property of the Config class?

//erlin!
#4

[eluser]drewbee[/eluser]
It should be irrelevant how they are loaded, as long as the database class is properly using $this->config->item();

At the very least, the config items would return an empty string.

Paste us your database config file.
#5

[eluser]TheFuzzy0ne[/eluser]
The database doesn't use the config class, it loads the file directly. That's why I suspect a call to $this->load->config(‘database’); is being made, since the config class looks for an array called "config". It's also possible that the code uses "quotes" instead of 'apostrophes'.




Theme © iAndrew 2016 - Forum software by © MyBB