Issues

ZF-7681: ZipArchive::getFromName() problem

Description

I've been putting together a search interface using Zend_Search_Lucene. I've more or less been following these instructions: http://framework.zend.com/manual/en/…

I have php_zip enabled and am running php 5.2.9-1.

When I run code that looks like this: $doc = Zend_Search_Lucene_Document_Docx::loadDocxFile($doc_filenameandpath); $index->addDocument($doc);

I am getting the following warnings:

Warning: ZipArchive::getFromName() [ziparchive.getfromname]: Invalid or unitialized Zip object in D:\wamp\www\ZendFramework-1.9.1\library\Zend\Search\Lucene\Document\Docx.php on line 61

Warning: Invalid argument supplied for foreach() in D:\wamp\www\ZendFramework-1.9.1\library\Zend\Search\Lucene\Document\Docx.php on line 62

Warning: ZipArchive::getFromName() [ziparchive.getfromname]: Invalid or unitialized Zip object in D:\wamp\www\ZendFramework-1.9.1\library\Zend\Search\Lucene\Document\OpenXml.php on line 87

Warning: Invalid argument supplied for foreach() in D:\wamp\www\ZendFramework-1.9.1\library\Zend\Search\Lucene\Document\OpenXml.php on line 88

Warning: ZipArchive::close() [ziparchive.close]: Invalid or unitialized Zip object in D:\wamp\www\ZendFramework-1.9.1\library\Zend\Search\Lucene\Document\Docx.php on line 103

NB. The nearest reference I can find to a similar problem on the issue tracker is this one: http://framework.zend.com/issues/browse/… ...but it doesn't really help much. I implemented the two patch files standard/trunk/library/Zend/Search/Lucene/Document/Docx.php standard/trunk/library/Zend/Search/Lucene/Document/Exception.php but things got worse: "Fatal error: Cannot redeclare class Zend_Search_Lucene_Document_OpenXml in D:\wamp\www\ZendFramework-1.9.1\library\Zend\Search\Lucene\Document\OpenXml.php on line 38"

Comments

Problem resolved.

I was attempting to index files of type .doc. Zend_Search_Lucene can only index files of type .docx.

Fixed. Correct exception is thrown now.