Strict Standards error when executing a search on new install of SphinxSeach extension.

Jump to: navigation, search

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.

Svemir Brkic (talk)14:44, 11 September 2012

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 ); } }

208.206.3.25415:35, 11 September 2012

If you changed php.ini for all environments, you are fine. That is just a notice, not an error.

Svemir Brkic (talk)17:26, 11 September 2012

exellent. Thank you for your help!!

208.206.3.25419:35, 11 September 2012
 
 

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)...

12.111.225.7719:29, 8 May 2013