Part of the EllisLab Network
   
 
Fatal error: Cannot redeclare *insert helper here*
Posted: 17 July 2007 09:12 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  16
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 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:

$this->loadController('VendorList');

Any ideas why this is happening?

TIA,
Cotton

 Signature 

AjaxDNS - get yur DNS on
v2 coming soon

Profile
 
 
Posted: 18 July 2007 03:09 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  515
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 03:32 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  493
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 02: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.

 Signature 

Frontier Web Development

Profile
 
 
Posted: 05 October 2007 05:17 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  633
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     (ongoing development site)

My Hippy Trail    Source code   

Latest Project

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120552 Total Logged-in Users: 33
Total Topics: 126602 Total Anonymous Users: 2
Total Replies: 665571 Total Guests: 299
Total Posts: 792173    
Members ( View Memberlist )
Newest Members:  vaalionClarkKentBaoHeredamferchiivanzDr.JohnRamin.HossainikreesmheatJackEdwards