Last modified: 2012-04-22 14:03:15 UTC
[rakkaus] 2012-04-19 11:39:16 v22011026445052.yourvserver.net mediawiki-bw_: /wiki/Translating:Waymarked_Trails Exception from line 54 of /www/w/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_WikiPage.php: Given namespace '2' is not an integer. Translate is getting a lot of these errors. Looking through the code, there seems to be some suspicious entries (such as SMW_DI_WikiPage.php), which is passing a float return new SMWDIWikiPage( $parts[0], floatval( $parts[1] ), $parts[2] ); <?php var_dump( is_integer( floatval( 1234 ) ) ); var_dump( is_integer( floatval( 1234.55 ) ) ); reedy@ubuntu64-web-esxi:~$ php test.php bool(false) bool(false) So that code is going to throw errors. It'd probably be saner if the constructor tried to make it an int if it isn't, and then bail if it's still not useable
Yes, using floatval there is wrong. The fix should be to give an integer (it is a namespace id after all). I would not insert code to try and convert floats to integers; it's the callers fault to pass a float as a namespace (PHP is just far too friendly in such cases; somebody passing a float as a namespace id is clearly confused and should be informed as early as possible).
[19-Apr-2012 11:18:43] <ul> <li>SMW_DI_WikiPage.php line 54 calls wfBacktrace()</li> <li>SMW_SQLStore2_Queries.php line 415 calls SMWDIWikiPage->__construct()</li> <li>SMW_SQLStore2_Queries.php line 284 calls SMWSQLStore2QueryEngine->getInstanceQueryResult()</li> <li>SMW_SQLStore2.php line 997 calls SMWSQLStore2QueryEngine->getQueryResult()</li> <li>SMW_QueryProcessor.php line 397 calls SMWSQLStore2->getQueryResult()</li> <li>SMW_QueryProcessor.php line 363 calls SMWQueryProcessor::getResultFromQuery()</li> <li>SMW_QueryProcessor.php line 341 calls SMWQueryProcessor::getResultFromQueryString()</li> <li>SMW_Ask.php line 34 calls SMWQueryProcessor::getResultFromFunctionParams()</li> <li>- line - calls SMWAsk::render()</li> <li>Parser.php line 3195 calls call_user_func_array()</li> <li>Preprocessor_DOM.php line 1043 calls Parser->braceSubstitution()</li> <li>Parser.php line 3355 calls PPFrame_DOM->expand()</li> <li>Preprocessor_DOM.php line 1043 calls Parser->braceSubstitution()</li> <li>Parser.php line 2984 calls PPFrame_DOM->expand()</li> <li>Parser.php line 1099 calls Parser->replaceVariables()</li> <li>Parser.php line 348 calls Parser->internalParse()</li> <li>WikiPage.php line 2922 calls Parser->parse()</li> <li>PoolCounter.php line 188 calls PoolWorkArticleView->doWork()</li> <li>Article.php line 591 calls PoolCounterWork->execute()</li> <li>ViewAction.php line 40 calls Article->view()</li> <li>Wiki.php line 483 calls ViewAction->show()</li> <li>Wiki.php line 277 calls MediaWiki->performAction()</li> <li>Wiki.php line 592 calls MediaWiki->performRequest()</li> <li>Wiki.php line 502 calls MediaWiki->main()</li> <li>index.php line 58 calls MediaWiki->run()</li> </ul> 2012-04-19 11:18:43 v22011026445052.yourvserver.net mediawiki-bw_: /wiki/Portal:Ru Exception from line 55 of /www/w/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_WikiPage.php: Given namespace '2' is not an integer.
Well, should be fixed by https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticMediaWiki.git;a=commit;h=cfb434f96b4dd4cd8e86422c1759cb343d7cbe84 I guess...
I found the floatval instances looking manually. The stack trace is to go with the exact error that was appearing on TW... So presumably this still isn't fixed
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticMediaWiki.git;a=commit;h=d8dcc0ec445560d5b44726597a3d5ee13ee91395
While trying to run SMWAdmin -> Data repair and upgrade following exception is thrown out with $wgShowExceptionDetails set in LocalSettings.php (affected versions from c10018a to d8dcc0e (last working version: d97a553): Given namespace '102' is not an integer. Backtrace: #0 /wiki/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php(1529): SMWDIWikiPage->__construct('_TYPE', '102', ':smw-preprop') #1 /wiki/extensions/SemanticMediaWiki/includes/jobs/SMW_RefreshJob.php(55): SMWSQLStore2->refreshData(1, 20, Array) #2 /wiki/includes/Wiki.php(434): SMWRefreshJob->run() #3 /wiki/includes/Wiki.php(408): MediaWiki->doJobs() #4 /wiki/includes/Wiki.php(593): MediaWiki->finalCleanup() #5 /wiki/includes/Wiki.php(502): MediaWiki->main() #6 /wiki/index.php(58): MediaWiki->run() #7 {main}
Should be really fixed now... if you still run into it with master, please lmk.