ZF-3528: Fatal error: Call to a member function createFile() on a non-object
Description
I get the following error:
Fatal error: Call to a member function createFile() on a non-object in D:\websites\site.com\core_lib\Zend\Search\Lucene\LockManager.php on line 56
when I run this code:
public function delete($item_id)
{
$hits = $this->lucene->find('product_id:'.$item_id);
$hit_count = count($hits);
if ($hit_count)
{
foreach ($hits as &$hit)
{ $this->lucene->delete($hit->id);
}
return $hit_count;
}
This error only seems to happen when there's an indexed item that needs to be deleted. when there's 0 results matched, no error.
I'm using wind2k3 standard with php 5.2.6
Comments
Posted by Aleksander Wons (xelah) on 2009-01-14T00:53:13.000+0000
I have similar issue to ZF-3528.
Code:
public static function deleteSingleGroupTags($boardID, $index) { $term = new Zend_Search_Lucene_Index_Term($boardID, 'boardID'); $query = new Zend_Search_Lucene_Search_Query_Term($term); $hits = array(); $hits = $index->find($query); foreach ($hits as $hit) $index->delete($hit->id); $index->commit(); }
public static function updateSingleGroupTags($boardID, $index) {
}
Here is how it works: This error occures after a call to addDocument(). The problem is that private variable $_directory is NULL after return from deleteSingleGroupTags().
If I move all code form deleteSingleGroupTags() to deleteSingleGroupTags() variable $_directory is present and addDocument() works fine.
If i call deleteSingleGroupTags() and check for $_directory one line before return form funcion it is present, but it disappears just after return from function. So I'm not sure if this is ZEND or PHP issue. Variable $_directory dissapears only after $index->find() returns any hits. It doesn't matter if I try to delete those hits. It will always fail if I call find().
Tested on versions: ZF 1.5.0 PR ZF 1.5.0 ZF 1.5.3 ZF 1.6.2 ZF 1.7.1 PHP 2.5.2 Vista Home Premium: Windows NT 6.0 build 6001
Posted by Aleksander Wons (xelah) on 2009-01-14T00:57:42.000+0000
To above comment: PHP is 5.2.5 of course :)
Posted by Adam Lundrigan (adamlundrigan) on 2011-06-08T21:04:18.000+0000
Is this still an issue?
If so, how are you setting up your instance of Zend_Search_Lucene? The problem the original poster describes can occur when the $directory constructor argument passed to that class is not a string nor an instance of Zend_Search_Lucene_Storage_Directory_Filesystem.