Welcome Guest, Not a member yet? Register   Sign In
connot redeclare, already declared
#1

[eluser]Coen de Jong[/eluser]
Hi!

I get this error when trying to get an application working on my webhosting space:

Code:
Fatal error: Cannot redeclare lang() (previously declared in /www/htdocs/dev/system/helpers/language_helper.php:42) in /www/htdocs/dev/system/application/helpers/my_language_helper.php on line 46

Line 46 is not the correct line in my own helper function, but the point is that this error doesn't happen on my local working copy...

Am I not seeing something here?
#2

[eluser]cahva[/eluser]
Its probably due to that you use windows locally which filesystem is not case-sensitive. Rename your own helper file as MY_language_helper.php and it should load. My quess is that CI doesnt check the case sensitivity and will try to load helpers(and all the other libraries) which start with capitalized MY_
#3

[eluser]Coen de Jong[/eluser]
Hmm seems to be that I had preloaded the language AND the my_language helpers in an array. Apperently that's not allowed? In other words if you replace a helper you cannot just replace one function, only replace them all and exclude the original or "extend" with new ones...? Not a combination of both?
#4

[eluser]cahva[/eluser]
Well language helper consists only of 1 function so whats the problem Wink

But use function_exists('yourfunction') to see that its not already declared. When using this, the first function that is declared is used so if you have autoload, just put your version before the CI one and that way your replacement will be loaded first and the ci version is ignored.




Theme © iAndrew 2016 - Forum software by © MyBB