Last modified: 2012-04-22 14:03:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T38089, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36089 - SMW Exception Given namespace '2' is not an integer
SMW Exception Given namespace '2' is not an integer
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-19 11:47 UTC by Sam Reed (reedy)
Modified: 2012-04-22 14:03 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Sam Reed (reedy) 2012-04-19 11:47:10 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
Comment 1 Markus Krötzsch 2012-04-19 12:35:42 UTC
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).
Comment 2 Sam Reed (reedy) 2012-04-19 12:37:09 UTC
[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.
Comment 4 Sam Reed (reedy) 2012-04-19 12:49:16 UTC
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
Comment 6 Hakisho Nukama 2012-04-20 21:22:32 UTC
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}
Comment 7 Jeroen De Dauw 2012-04-22 14:03:15 UTC
Should be really fixed now... if you still run into it with master, please lmk.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links