Part of the EllisLab Network
   
 
Fatal error: Cannot redeclare *insert helper here*
Posted: 17 July 2007 10:12 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  9
Joined  03-23-2007

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:

Fatal errorCannot redeclare site_url() (previously declared in /var/www/httpdocs/site/helpers/url_helper.php:40in /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:

$this->loadController('VendorList'); 

Any ideas why this is happening?

TIA,
Cotton

Profile
 
 
Posted: 18 July 2007 04:09 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  103
Joined  12-05-2006

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

 Signature 

FreakAuth_light: pluggable & extendable authentication library that works on CI 1.5.X

CI SWIFT MAILER: 44% less memory than PHPMailer at double speed

Using Zend Framework components in Code Igniter

Profile
 
 
Posted: 18 July 2007 04:32 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  297
Joined  02-21-2007

1) redeclare thing
Helpers (like other CI elements) can be loaded several times, CI checks for this with

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…

Profile
 
 
Posted: 05 October 2007 03:50 AM   [ Ignore ]   [ # 3 ]  
Summer Student
Avatar
Total Posts:  4
Joined  10-05-2007

Hi guys,
having the same problem. I didn’t request URI helper in my application at all, but still get the same message.

Profile
 
 
Posted: 05 October 2007 06:17 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  749
Joined  12-26-2006

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
 

 Signature 

Joke of the day - Bulletin Board Ideas     (ongoing development site)

My Hippy Trail    Source code   

Latest Project

Profile