Hi Carlton,

It's a ZF-7256 related issue.

Zend_Search_Lucene is designed to be turned on using one require_once
call:
----------------------------
require_once 'Zend/Search/Lucene.php';
---------

It takes less time than common index opening/querying. Moreover in some
environments it's faster than conditional files inclusion.
Nevertheless it should be redesigned to complain ZF coding standards.

I could recommend using the following workaround before that, just add
"require_once 'Zend/Search/Lucene.php';" in the beginning of your code.
It will include all files in the right order.

If it doesn't help, that means autoloader treats already parsed
Zend/Search/Lucene/Analysis/Analyzer/Common.php file and just requested
Zend/Search/Lucene/Analysis/Analyzer/Common.php as different files. That
may happen if include path was changed since last file access.

With best regards,
   Alexander Veremyev.

> -----Original Message-----
> From: Carlton Gibson [mailto:carlton.gib...@noumenal.co.uk]
> Sent: Tuesday, August 18, 2009 10:48 PM
> To: Zend Framework General
> Subject: [fw-general] Autoloader/Require mystery...
> 
> Hi all, I'm wondering if anyone can help.
> 
> I'm using a RecursiveDirectoryIterator to go through the Zend
> Framework files and generate clippings for my favourite text editor. I
> am passing this an absolute path to the Zend Framework library.
> 
> The library is also on my include path and I have the new Autoloader
> enabled. (The copy of the library I am iterating through is the same
> as that on my include_path)
> 
> My script seems to be working fine. Starting at the top, all goes well
> until I reach Zend/Search/Lucene/Analysis/Analyzer/Common/Text/
> CaseInsensitive.php
> 
> At this point I get a Fatal Error:
> 
> Fatal error: Cannot redeclare class
> Zend_Search_Lucene_Analysis_Analyzer_Common in [my set up]/library/
> Zend/Search/Lucene/Analysis/Analyzer/Common.php on line 41
> 
> The _Common file is being required in Zend/Search/Lucene/Analysis/
> Analyzer/Common/Text.php but it must have been included sometime
> before that.
> 
> My first thought was to comment out the offending require_once
> statement -- I have the Autoloader so it shouldn't be necessary.
> 
> If I do comment out the offening require I get another fatal error:
> 
> Fatal error: Class 'Zend_Search_Lucene_Analysis_Analyzer_Common' not
> found in [my set up]/Zend/Search/Lucene/Analysis/Analyzer/Common/
> Utf8.php
> 
> And this one doesn't make much sense because there's still an
> uncommented require_once for the missing class (file) just a few lines
> above.
> 
> __What's more__ the stack trace shows that immediately after the
> Zend_Loader::loadClass() call (which presumably is stepping in where
> the commented require_once left off) the is a require_once being
> issued FROM the ../Common.php file in which the supposedly missing
> class is defined.
> 
> i.e. I can't really see how it's actually missing !? It's a bit of a
> mystery.
> 
> I guess that this is something PHP related but I can't think what. Any
> ideas (especially good ones :-) would really be appreciated.
> 
> TIA
> Carlton

Reply via email to