Jump to content

[4.4.10] Search throws error merging 2 items without Comment


teraßyte

Recommended Posts

Posted

In system/Content/Search/Elastic/Index.php::resetLastComment() you have this code on lines 877-884:

					$where = NULL;
					if( $ignoreId !== NULL )
					{
						$commentClass = $itemClass::$commentClass;
						$commentIdColumn = $commentClass::$databaseColumnId;

						$where = array( $commentClass::$databaseTable . '.' . $commentClass::$databasePrefix . $commentIdColumn . '<>?', $ignoreId );
					}

 

The problem is that one of my custom applications does not implement the \IPS\Content\Comment but only \IPS\Content\Review. The code above clearly doesn't check if the comments class is available before trying to load/use it. And the fix here is not to simply skip the ignore code if no Comment class is available, but it should be using the correct Comment/Review class based on the class data being passed to it.

 

Here's a log of the error btw:

Error: Class name must be a valid object or a string (0)
#0 /home/domain.com/public_html/system/Content/Search/Elastic/Index.php(412): IPS\Content\Search\Elastic\_Index->resetLastComment(Array, 43058, 4048)
#1 /home/domain.com/public_html/system/Content/Comment.php(883): IPS\Content\Search\Elastic\_Index->removeFromSearchIndex(Object(IPS\reviews\Product\Review))
#2 /home/domain.com/public_html/system/Content/Review.php(396): IPS\Content\_Comment->delete()
#3 /home/domain.com/public_html/applications/reviews/sources/Generic/Item.php(1714): IPS\Content\_Review->delete()
#4 /home/domain.com/public_html/system/Helpers/Table/Content.php(679): IPS\reviews\Generic\_Item->mergeIn(Array, false)
#5 /home/domain.com/public_html/system/Helpers/Table/Content.php(227): IPS\Helpers\Table\_Content->multimod()
#6 /home/domain.com/public_html/applications/reviews/modules/front/products/browse.php(108): IPS\Helpers\Table\_Content->__construct('IPS\\reviews\\Pro...', Object(IPS\Http\Url\Friendly), Array)
#7 /home/domain.com/public_html/applications/reviews/modules/front/products/browse.php(35): IPS\reviews\modules\front\products\_browse->_category(Object(IPS\reviews\Pcategory))
#8 /home/domain.com/public_html/system/Dispatcher/Controller.php(96): IPS\reviews\modules\front\products\_browse->manage()
#9 /home/domain.com/public_html/system/Dispatcher/Dispatcher.php(152): IPS\Dispatcher\_Controller->execute()
#10 /home/domain.com/public_html/index.php(13): IPS\_Dispatcher->run()
#11 {main}

 

The issue above happens with Elastic Search, but most likely the normal MySQL search has the same issue.

Posted

Can you please share with me your application so I can test? This issue only seems to be present with (1) an application that has a review class but no comment class, and (2) when using ElasticSearch (the issue is not present with MySQL search). I can visually see the problem, but will need an example app to test with in order to look into a proper solution.

Posted

Let me see what I can do about stripping it down to a simple application. The current one relies on having also other apps installed at the same time so you wouldn't be able to test with it alone.

Posted

I'm happy to look into the issue closer, but yeah it would be extremely helpful to have a sample app to test with. We don't have any apps that do not support comments but support reviews.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...