Cannot redeclare class Zend_Loader

For programming and general questions on Zend Framework

Re: Cannot redeclare class Zend_Loader

Postby guice on Fri Oct 23, 2009 4:51 pm

On the windows platform, there's an old issue I ran into with (include|require)_once functions when trying to include a file using different directory path separators. (Unsure if it's been fixed by now or not)

If you include_once /File/File.php and use the auto-loader, it'll error out because PHP doesn't see \\File\\File.php has being previously included, even though they map to the same file.
I was able to replicate it by using include_once a few times, flipping around the \ and / in the paths. There's one specific order that will cause the error.

I could give details if I still had my old test sandbox (been a year). However, since then, I've also moved to just dedicatedly using the auto-loader, except for Zend_Application (using 1.9.x).
guice
 
Posts: 166
Joined: Thu Mar 05, 2009 5:21 pm

Re: Cannot redeclare class Zend_Loader

Postby blackmorenights on Thu Oct 29, 2009 10:30 pm

I recently upgrade the zend framework 1.9.5 and now I have the same problem.

Oks i'ts solves the problem but... it's a big problem... because now I need to move / remove my library folder and setup the php.ini

---- update --

Sorry... i solved it deleting

Code: Select all
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));



from index.php
blackmorenights
 
Posts: 1
Joined: Thu Oct 29, 2009 10:25 pm

Re: Cannot redeclare class Zend_Loader

Postby ryy705 on Sun Nov 29, 2009 11:33 pm

I don't understand why did commenting out that line work? Please explain.
ryy705
 
Posts: 1
Joined: Sun Nov 29, 2009 11:32 pm

Re: Cannot redeclare class Zend_Loader

Postby mjstelly on Sun Dec 20, 2009 8:21 pm

jomara wrote:Commenting out that line worked for me as well. Big Thanks!!!

sweet beans in a basket! I lost nearly a week's productivity hunting this problem down. that's FORTY HOURS, people. i chatted with the IRC folks on #zftalk.
know what they said?
that should NEVER be in your application.ini anyways :S

i said
well, i didn't put it there.

they said,
if it is there by default: its WRONG. i know, Zend_Tool adds it by itself, but still: its bad that Zend_Tool does that.


No kidding. I was directed to http://framework.zend.com/issues to file it in their issue tracker.
mjstelly
 
Posts: 23
Joined: Wed Nov 18, 2009 6:10 pm

Re: Cannot redeclare class Zend_Loader

Postby sonnysavage on Tue Dec 22, 2009 8:56 pm

This error showed when I was trying to use the ZF command-line interface (cli), and the solution here fixed it.
sonnysavage
 
Posts: 62
Joined: Thu Dec 10, 2009 3:12 pm

Re: Cannot redeclare class Zend_Loader

Postby dowanx on Sun Jan 24, 2010 5:22 am

Worked for me too thanks! Could anyone explain why this fixed it? I would not want to comment this line out just to find out it is causing bugs later on. Many thanks for the quick great responses.

Bryan
dowanx
 
Posts: 1
Joined: Sun Jan 24, 2010 5:21 am

Re: Cannot redeclare class Zend_Loader

Postby sonnysavage on Mon Jan 25, 2010 4:31 pm

This part of index.php does what is needed:
Code: Select all
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));


This line in the application.ini duplicates that and causes the error to be thrown:
Code: Select all
includePaths.library = APPLICATION_PATH "/../library"


The Zend CLI Tool automatically does both, and it's a bug.
sonnysavage
 
Posts: 62
Joined: Thu Dec 10, 2009 3:12 pm

Re: Cannot redeclare class Zend_Loader

Postby juanca2626 on Fri Aug 27, 2010 3:39 am

Good morning.
I have the same problem and the solution proved to comment the line:

; IncludePaths.library = APPLICATION_PATH "/../ library "

But ocacion me another error.

C:\xampp\htdocs\almacen>zf create action add Index

Fatal error: Call to a member function search() on a non-object in C:\xampp\php\
PEAR\Zend\Tool\Project\Provider\Action.php on line 92



Some help please
juanca2626
 
Posts: 2
Joined: Fri Aug 27, 2010 3:37 am

Re: Cannot redeclare class Zend_Loader

Postby jot_es on Mon Jul 11, 2011 1:38 am

If you are using "Zend Server CE", try to remove ':/usr/local/zend/share/ZendFramework/library" in php.ini

Worked for me.
jot_es
 
Posts: 1
Joined: Mon Jul 11, 2011 1:33 am

Re: Cannot redeclare class Zend_Loader

Postby mcneela86 on Mon Jul 30, 2012 1:58 am

I'm new this and this may be a rookie question - but where can I find the .ini file to comment out the line mentioned above?
mcneela86
 
Posts: 1
Joined: Mon Jul 30, 2012 1:57 am

Previous

Return to Zend Framework

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests

cron