CodeIgniter Forums
Fatal error: Cannot redeclare *insert helper here* - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Fatal error: Cannot redeclare *insert helper here* (/showthread.php?tid=2130)



Fatal error: Cannot redeclare *insert helper here* - El Forum - 07-17-2007

[eluser]codercotton[/eluser]
Hey all,

First off, I've read all the threads from searching "cannot redeclare". None of my class names conflict with other classes, and there are no other loaders for these helpers.

I have a library that I'm trying to load a controller and a model into, no matter which one I try to load, I first get:
Code:
Fatal error: Cannot redeclare site_url() (previously declared in /var/www/httpdocs/site/helpers/url_helper.php:40) in /var/www/httpdocs/site/helpers/url_helper.php on line 40
I've tried removing the helpers from config/autoload.php, but it keeps trowing an error on the next helper, all the way down to some sort of 'no helpers defined' errmsg.

We're porting old authentication code to the FreakAuth CI addon, and it works great. I'm wondering if this addon has anything to do with it though.

FWIW, all the auth stuff works fine, it's just when I try to include some of my old classes that it starts throwing errors. I've commented everything out of the controller I'm loading, so it's the act of just including the controller that is bombing it out, nothing in the controller itself (just an echo in there). I'm loading the controller like this:
Code:
$this->loadController('VendorList');
Any ideas why this is happening?

TIA,
Cotton


Fatal error: Cannot redeclare *insert helper here* - El Forum - 07-18-2007

[eluser]danfreak[/eluser]
Are you sure you are not loading the url helper twice somewhere?

i.e. you autoloaded it, and then loaded it again from another class/controller?

If I don't remember badly, the url helper get autoloaded in the autoload_demo.php file included in FreakAuth.

Dan


Fatal error: Cannot redeclare *insert helper here* - El Forum - 07-18-2007

[eluser]Grahack[/eluser]
1) redeclare thing
Helpers (like other CI elements) can be loaded several times, CI checks for this with
Code:
if (isset($this->_ci_helpers[$helper]))
{
    continue;
}
Try to search this string: 'function site_url' in your files. It must be in the url_helper AND at another place.

When you say 'it keeps trowing an error on the next helper' I guess the function is another one (not site_url). I'm curious, could you make a list of those 'bad functions'?

2) auth addon
Could you detail a bit 'old authentication code'? What do you port to what?

3) loadController
This is not a CI function, I can't say anything about those errors...


Fatal error: Cannot redeclare *insert helper here* - El Forum - 10-05-2007

[eluser]Xobb[/eluser]
Hi guys,
having the same problem. I didn't request URI helper in my application at all, but still get the same message.


Fatal error: Cannot redeclare *insert helper here* - El Forum - 10-05-2007

[eluser]John_Betong[/eluser]
Hi coder_cotton,

Have you checked your error logs? I usually find they are more descriptive.

>>> I have a library that I’m trying to load a controller and a model into...
Is that statement correct? Shouldn't that be "I have a controller that I'm trying to load a library and a model into"?

Cheers,

John_Betong