Strict Standards error when executing a search on new install of SphinxSeach extension.
You could do one or both of these:
- Turn off "Strict Standards" in your php.ini. I do not run php 5.4 right now, but it should not be too hard to figure out. At least turn it off in production environment.
- Change SphinxMWSearch::userHighlightPrefs declaration to match SearchEngine::userHighlightPrefs() - probably something related to public vs. protected or private.
We will fix it in the code eventually, but you seem to need a quick fix.
I was able to turn off strict standards in php.ini. This go rid of the error. Changed:
- error_reporting = E_ALL
to error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT Is there anything I should be on the lookout for with error_reporting set this way?
I took a look at SphinxMWSearch.php and only see a userHighlightPrefs declaration shown below and then it being called later(also shown below). Both snippits posted below. What should I change? Sorry I'm not a programmer.
public static function userHighlightPrefs( &$user ) { $contextlines = $user->getOption( 'contextlines', 2 ); $contextchars = $user->getOption( 'contextchars', 75 ); return array( $contextlines, $contextchars ); }
function getTextSnippet( $terms ) { global $wgUser, $wgAdvancedSearchHighlighting; global $wgSphinxSearchMWHighlighter, $wgSphinxSearch_index;
$this->initText(); list( $contextlines, $contextchars ) = SphinxMWSearch::userHighlightPrefs( $wgUser ); if ( $wgSphinxSearchMWHighlighter ) { $h = new SearchHighlighter(); if ( $wgAdvancedSearchHighlighting ) { return $h->highlightText( $this->mText, $terms, $contextlines, $contextchars ); } else { return $h->highlightSimple( $this->mText, $terms, $contextlines, $contextchars ); } }
If you changed php.ini for all environments, you are fine. That is just a notice, not an error.
The Strict Standards notice is being displayed because userHighlightPrefs is indeed declared differently:
- In MediaWiki 1.20.5, SearchEngine.php the declaration is for 'all users' as: userHighlightPrefs()
- In SphinxSearch 0.8.5, SphinxMWSearch.php the declaration is for a 'given user' as: userHighlightPrefs( &$user )
And of course the corresponding differences in variable assignment statements inside the function(s)...